mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-02 14:38:50 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7763141b7 | ||
|
|
bf2d729a39 | ||
|
|
a352273b08 | ||
|
|
e685ff5f4c | ||
|
|
dbe107e669 | ||
|
|
3e266ec952 | ||
|
|
cd2b5db342 | ||
|
|
f3fc016f31 | ||
|
|
381627266f | ||
|
|
f779ba4228 | ||
|
|
b004ec943d | ||
|
|
647243f1cf | ||
|
|
12e9ccbc8a | ||
|
|
2a9b14ce54 | ||
|
|
f7949db0d3 | ||
|
|
2a14ab1e21 | ||
|
|
9de50f684f | ||
|
|
2c90290c84 | ||
|
|
9fc06c2132 | ||
|
|
def891268b | ||
|
|
8a3fa20408 | ||
|
|
5d6ca06f49 | ||
|
|
4913d6e50a | ||
|
|
ca8cef4e26 | ||
|
|
2a8f4b1ea9 | ||
|
|
1d0a5bcfd9 | ||
|
|
5965442e48 | ||
|
|
f7ed2d5b60 | ||
|
|
ec9d787be4 | ||
|
|
abf259543d | ||
|
|
9d8a29388c | ||
|
|
00f9d0449c | ||
|
|
a46b586832 | ||
|
|
dc50fe6dbb | ||
|
|
a6d483ca48 | ||
|
|
b1babdbc09 | ||
|
|
f8f97344fd | ||
|
|
48ee030372 | ||
|
|
fe1d6e6b05 | ||
|
|
c1f5bb3375 | ||
|
|
d4e367baaf | ||
|
|
ce87bc488c | ||
|
|
dc55401b78 | ||
|
|
3b55e890a8 | ||
|
|
bacd9c171d | ||
|
|
29d28197bb | ||
|
|
4646c6f027 | ||
|
|
30a391031b | ||
|
|
22de50c081 | ||
|
|
d0730c5e9b | ||
|
|
b781f0ca45 | ||
|
|
31959beb85 | ||
|
|
de2c731295 | ||
|
|
93ff6bae45 | ||
|
|
1266f4a7b6 | ||
|
|
a06cf65d10 | ||
|
|
5b55c81046 | ||
|
|
6acd0ac352 | ||
|
|
55d8d46334 | ||
|
|
4b179191d4 | ||
|
|
1ec52903ca | ||
|
|
7e5d4cce06 | ||
|
|
681b39692a | ||
|
|
39c485644d | ||
|
|
634bbffd46 | ||
|
|
273a4a8a89 | ||
|
|
b8249d5457 | ||
|
|
372a95632c | ||
|
|
faae020dd4 | ||
|
|
5e89d62688 | ||
|
|
51ac8d1e8c | ||
|
|
466f230dc4 | ||
|
|
06b106151f | ||
|
|
a0573c8623 | ||
|
|
076e327c9a | ||
|
|
c5f150e003 | ||
|
|
4b2b564591 | ||
|
|
3f57c566df | ||
|
|
5e6547611b | ||
|
|
be221b70d3 | ||
|
|
f7dea332de | ||
|
|
d2758de972 | ||
|
|
c9acb09d08 | ||
|
|
73ad12ed02 | ||
|
|
4654460e22 | ||
|
|
e23ba224aa | ||
|
|
878a2eb6c0 | ||
|
|
290e23c190 | ||
|
|
546eebe1cf | ||
|
|
fd4fa877ec | ||
|
|
0a2f1ae856 | ||
|
|
72aafb8a16 | ||
|
|
492aa947e6 | ||
|
|
20f35143db | ||
|
|
cc74fac733 | ||
|
|
b01e30d7b1 | ||
|
|
98a85faa1c | ||
|
|
49a5087d70 | ||
|
|
1e31cc0ace | ||
|
|
e09b3482ba | ||
|
|
a31df20979 | ||
|
|
f6fb7cc017 | ||
|
|
04e03e4fef | ||
|
|
94bd814186 | ||
|
|
93d86f849a | ||
|
|
d6886bdd3f | ||
|
|
8c6c6119f1 | ||
|
|
2af99e35a7 | ||
|
|
03e6e534f5 | ||
|
|
45f9f72daa | ||
|
|
c4a9db0a79 | ||
|
|
8be251382d | ||
|
|
6bfda0c64d | ||
|
|
cf8eb3e590 | ||
|
|
44c4ea5fba |
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
ko_fi: dunak
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Issue checklist
|
||||||
|
> Please put `x` inside of the box that matches your issue.
|
||||||
|
|
||||||
|
- [ ] I am using the latest release
|
||||||
|
- [ ] I have referenced previously reported issues
|
||||||
|
- [ ] I have referenced available documentation and cannot resolve the issue
|
||||||
|
- [ ] I'm certain this is an issue with oxymysql, and not with my resource
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**Code**
|
||||||
|
```lua
|
||||||
|
If applicable, include the query and relevant code
|
||||||
|
```
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
||||||
|
|
||||||
|
**Server details**
|
||||||
|
- FX Server artifact
|
||||||
|
- Operating system
|
||||||
|
- Framework
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
name: Pre-Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
tag:
|
||||||
|
description: 'Version tag'
|
||||||
|
required: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
create-release:
|
||||||
|
name: Build and Create Tagged Pre release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Install archive tools
|
||||||
|
run: sudo apt install zip
|
||||||
|
|
||||||
|
- name: Checkout source code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.ref }}
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn
|
||||||
|
|
||||||
|
- name: Run build
|
||||||
|
run: yarn build
|
||||||
|
|
||||||
|
- name: Bundle files
|
||||||
|
run: |
|
||||||
|
mv dist oxmysql
|
||||||
|
zip -r oxmysql-${{ github.event.inputs.tag }}.zip oxmysql
|
||||||
|
|
||||||
|
- name: Create Release
|
||||||
|
uses: "marvinpinto/[email protected]"
|
||||||
|
id: auto_release
|
||||||
|
with:
|
||||||
|
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
title: "Experimental - ${{ github.event.inputs.tag }} (FOR TESTING PURPOSE)"
|
||||||
|
prerelease: true
|
||||||
|
automatic_release_tag: "${{ github.event.inputs.tag }}"
|
||||||
|
files: oxmysql-${{ github.event.inputs.tag }}.zip
|
||||||
|
|
||||||
|
env:
|
||||||
|
CI: false
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
create-release:
|
||||||
|
name: Build and Create Tagged Release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Install archive tools
|
||||||
|
run: sudo apt install zip
|
||||||
|
|
||||||
|
- name: Checkout source code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.ref }}
|
||||||
|
|
||||||
|
- name: Set env
|
||||||
|
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn
|
||||||
|
|
||||||
|
- name: Run build
|
||||||
|
run: yarn build
|
||||||
|
|
||||||
|
- name: Bundle files
|
||||||
|
run: |
|
||||||
|
mv dist oxmysql
|
||||||
|
zip -r oxmysql-${{ env.RELEASE_VERSION }}.zip oxmysql
|
||||||
|
|
||||||
|
- name: Create Release
|
||||||
|
uses: "marvinpinto/[email protected]"
|
||||||
|
id: auto_release
|
||||||
|
with:
|
||||||
|
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
title: ${{ env.RELEASE_VERSION }}
|
||||||
|
prerelease: false
|
||||||
|
files: oxmysql-${{ env.RELEASE_VERSION }}.zip
|
||||||
|
|
||||||
|
env:
|
||||||
|
CI: false
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -111,10 +111,12 @@ dist
|
|||||||
.vscode-test
|
.vscode-test
|
||||||
|
|
||||||
# yarn v2
|
# yarn v2
|
||||||
|
yarn.lock
|
||||||
.yarn/cache
|
.yarn/cache
|
||||||
.yarn/unplugged
|
.yarn/unplugged
|
||||||
.yarn/build-state.yml
|
.yarn/build-state.yml
|
||||||
.yarn/install-state.gz
|
.yarn/install-state.gz
|
||||||
.pnp.*
|
.pnp.*
|
||||||
|
|
||||||
|
# FiveM
|
||||||
.yarn.installed
|
.yarn.installed
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"printWidth": 120,
|
||||||
|
"singleQuote": true,
|
||||||
|
"useTabs": false,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"semi": true,
|
||||||
|
"bracketSpacing": true,
|
||||||
|
"trailingComma": "es5"
|
||||||
|
}
|
||||||
@@ -1,5 +1,41 @@
|
|||||||
<h2 align='center'>oxmysql (WIP) - not ready for use<p><a href='https://overextended.github.io/oxmysql/'>Documentation</a></p></h2>
|
<h1 align='center'><a href='https://overextended.github.io/oxmysql/'>Documentation</a></h2>
|
||||||
|
|
||||||
oxmysql is a middleware for FXServer which utilises [node-mysql2](https://github.com/sidorares/node-mysql2) to communicate with a database and respond with the query results.
|
|
||||||
|
|
||||||
Calling the JS exports will result in async behaviour, or you can use the Lua exports to return a promise and await the response.
|
### Introduction
|
||||||
|
Oxmysql is an alternative to the unmaintained mysql-async/ghmattimysql resources, utilising [node-mysql2](https://github.com/sidorares/node-mysql2) rather than [mysqljs](https://github.com/mysqljs/mysql).
|
||||||
|
|
||||||
|
There are several incompatibilities in the provided API, meaning we cannot guarantee 100% success when using a "drag-and-drop" mentality. For convenience we have included `@oxmysql/lib/MySQL.lua` to replace mysql-async in your resource manifests.
|
||||||
|
|
||||||
|
For more information regarding the use of queries, refer to the documentation linked above.
|
||||||
|
|
||||||
|
### Features
|
||||||
|
- Support for URI connection strings and semicolon separated values
|
||||||
|
- Asynchronous queries utilising mysql2/promises connection pool
|
||||||
|
- Lua promises in the `wrapper.lua` and `lib/MySQL.lua` files for improved performance when using sync functions
|
||||||
|
- Javascript async_retval exports when using recent FX Server builds (requires wrapper.lua to be removed)
|
||||||
|
- Support for placeholder values (named and unnamed) to improve query speed and increase security against SQL injection
|
||||||
|
- Improved error checking when placeholders and parameters do not match
|
||||||
|
|
||||||
|
### Placeholders
|
||||||
|
This allows queries to be properly prepared and escaped, as well as improve query times for frequently accessed queries.
|
||||||
|
The following lines are equivalent.
|
||||||
|
|
||||||
|
```
|
||||||
|
"SELECT group FROM users WHERE identifier = ?", {identifier}
|
||||||
|
"SELECT group FROM users WHERE identifier = :identifier", {identifier = identifier}
|
||||||
|
"SELECT group FROM users WHERE identifier = @identifier", {['@identifier'] = identifier}
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also use the following syntax when you are uncertain about the column to select.
|
||||||
|
|
||||||
|
```
|
||||||
|
"SELECT ?? FROM users WHERE identifier = ?", {column, identifier}
|
||||||
|
instead of using
|
||||||
|
"SELECT "..column.." FROM users WHERE identifier = ?", {identifier}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
<br><br><br><br><br>
|
||||||
|
<hr>
|
||||||
|
<p align='center'><a href='https://discord.io/overextended'>Discord</a></p>
|
||||||
|
<hr>
|
||||||
@@ -1,10 +1,17 @@
|
|||||||
fx_version 'cerulean'
|
fx_version 'cerulean'
|
||||||
game 'gta5'
|
game 'common'
|
||||||
|
|
||||||
name 'oxmysql'
|
name 'oxmysql'
|
||||||
description 'Database wrapper for FiveM utilising node-mysql2 offering improved performance and security.'
|
description 'Database wrapper for FiveM utilising node-mysql2 offering improved performance and security.'
|
||||||
version '0.1.0'
|
version '1.8.2'
|
||||||
url 'https://github.com/overextended/oxmysql'
|
url 'https://github.com/overextended/oxmysql'
|
||||||
author 'overextended'
|
author 'overextended'
|
||||||
|
use_fxv2_oal 'yes'
|
||||||
|
lua54 'yes'
|
||||||
|
|
||||||
server_scripts {'oxmysql.js', 'wrapper.lua'}
|
server_scripts {
|
||||||
|
'oxmysql.js',
|
||||||
|
'wrapper.lua'
|
||||||
|
}
|
||||||
|
|
||||||
|
provide 'mysql-async'
|
||||||
@@ -0,0 +1,187 @@
|
|||||||
|
-- This file allows simple conversion from MySQL-Async to Oxmysql
|
||||||
|
-- Replace any references to '@mysql-async' in your resource manifests to use '@oxmysql' instead
|
||||||
|
-- Store is used for compatibility only
|
||||||
|
|
||||||
|
local Ox = exports.oxmysql
|
||||||
|
local Store = {}
|
||||||
|
|
||||||
|
local function safeArgs(query, parameters, cb, transaction)
|
||||||
|
if type(query) == 'number' then query = Store[query] end
|
||||||
|
if transaction then
|
||||||
|
assert(type(query) == 'table', ('A table was expected for the transaction, but instead received %s'):format(query))
|
||||||
|
else
|
||||||
|
assert(type(query) == 'string', ('A string was expected for the query, but instead received %s'):format(query))
|
||||||
|
end
|
||||||
|
if cb then
|
||||||
|
assert(type(cb) == 'function', ('A callback function was expected, but instead received %s'):format(cb))
|
||||||
|
end
|
||||||
|
local type = parameters and type(parameters)
|
||||||
|
if type and type ~= 'table' and type ~= 'function' then
|
||||||
|
assert(nil, ('A %s was expected, but instead received %s'):format(cb and 'table' or 'function', parameters))
|
||||||
|
end
|
||||||
|
return query, parameters, cb
|
||||||
|
end
|
||||||
|
|
||||||
|
MySQL = { Async = {}, Sync = {} }
|
||||||
|
|
||||||
|
---@param query string
|
||||||
|
---@param parameters? table|function
|
||||||
|
---@param cb? function
|
||||||
|
---@return integer result
|
||||||
|
---returns number of rows updated by the executed query
|
||||||
|
MySQL.Async.execute = function(query, parameters, cb)
|
||||||
|
Ox:update(safeArgs(query, parameters, cb))
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param query string
|
||||||
|
---@param parameters? table|function
|
||||||
|
---@param cb? function
|
||||||
|
---@return table result
|
||||||
|
---returns array of matching rows or result data
|
||||||
|
MySQL.Async.fetchAll = function(query, parameters, cb)
|
||||||
|
Ox:execute(safeArgs(query, parameters, cb))
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param query string
|
||||||
|
---@param parameters? table|function
|
||||||
|
---@param cb? function
|
||||||
|
---@return integer|string
|
||||||
|
---returns value of the first column of a single row
|
||||||
|
MySQL.Async.fetchScalar = function(query, parameters, cb)
|
||||||
|
Ox:scalar(safeArgs(query, parameters, cb))
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param query string
|
||||||
|
---@param parameters? table|function
|
||||||
|
---@param cb? function
|
||||||
|
---@return table result
|
||||||
|
---returns table containing key value pairs
|
||||||
|
MySQL.Async.fetchSingle = function(query, parameters, cb)
|
||||||
|
Ox:single(safeArgs(query, parameters, cb))
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param query string
|
||||||
|
---@param parameters? table|function
|
||||||
|
---@param cb? function
|
||||||
|
---@return table result
|
||||||
|
---returns the last inserted id
|
||||||
|
MySQL.Async.insert = function(query, parameters, cb)
|
||||||
|
Ox:insert(safeArgs(query, parameters, cb))
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param queries table
|
||||||
|
---@param parameters? table|function
|
||||||
|
---@param cb? function
|
||||||
|
---@return boolean result
|
||||||
|
---returns true when the transaction has succeeded
|
||||||
|
MySQL.Async.transaction = function(queries, parameters, cb)
|
||||||
|
Ox:transaction(safeArgs(queries, parameters, cb, true))
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param query string
|
||||||
|
---@param cb? function
|
||||||
|
---@return integer result
|
||||||
|
---returns the id used to reference a stored query string
|
||||||
|
MySQL.Async.store = function(query, cb)
|
||||||
|
assert(type(query) == 'string', 'The SQL Query must be a string')
|
||||||
|
local store = #Store+1
|
||||||
|
Store[store] = query
|
||||||
|
cb(store)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param query string
|
||||||
|
---@param parameters? table|function
|
||||||
|
---@return integer result
|
||||||
|
---returns number of rows updated by the executed query
|
||||||
|
MySQL.Sync.execute = function(query, parameters)
|
||||||
|
query, parameters = safeArgs(query, parameters)
|
||||||
|
local promise = promise.new()
|
||||||
|
Ox:update(query, parameters, function(result)
|
||||||
|
promise:resolve(result)
|
||||||
|
end)
|
||||||
|
return Citizen.Await(promise)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param query string
|
||||||
|
---@param parameters? table|function
|
||||||
|
---@return table result
|
||||||
|
---returns array of matching rows or result data
|
||||||
|
MySQL.Sync.fetchAll = function(query, parameters)
|
||||||
|
query, parameters = safeArgs(query, parameters)
|
||||||
|
local promise = promise.new()
|
||||||
|
Ox:execute(query, parameters, function(result)
|
||||||
|
promise:resolve(result)
|
||||||
|
end)
|
||||||
|
return Citizen.Await(promise)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param query string
|
||||||
|
---@param parameters? table|function
|
||||||
|
---@return integer|string
|
||||||
|
---returns value of the first column of a single row
|
||||||
|
MySQL.Sync.fetchScalar = function(query, parameters)
|
||||||
|
query, parameters = safeArgs(query, parameters)
|
||||||
|
local promise = promise.new()
|
||||||
|
Ox:scalar(query, parameters, function(result)
|
||||||
|
promise:resolve(result)
|
||||||
|
end)
|
||||||
|
return Citizen.Await(promise)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param query string
|
||||||
|
---@param parameters? table|function
|
||||||
|
---@return table result
|
||||||
|
---returns table containing key value pairs
|
||||||
|
MySQL.Sync.fetchSingle = function(query, parameters)
|
||||||
|
query, parameters = safeArgs(query, parameters)
|
||||||
|
local promise = promise.new()
|
||||||
|
Ox:single(query, parameters, function(result)
|
||||||
|
promise:resolve(result)
|
||||||
|
end)
|
||||||
|
return Citizen.Await(promise)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param query string
|
||||||
|
---@param parameters? table|function
|
||||||
|
---@return table result
|
||||||
|
---returns the last inserted id
|
||||||
|
MySQL.Sync.insert = function(query, parameters)
|
||||||
|
query, parameters = safeArgs(query, parameters)
|
||||||
|
local promise = promise.new()
|
||||||
|
Ox:insert(query, parameters, function(result)
|
||||||
|
promise:resolve(result)
|
||||||
|
end)
|
||||||
|
return Citizen.Await(promise)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param queries table
|
||||||
|
---@param parameters? table|function
|
||||||
|
---@return boolean result
|
||||||
|
---returns true when the transaction has succeeded
|
||||||
|
MySQL.Sync.transaction = function(queries, parameters)
|
||||||
|
queries, parameters = safeArgs(queries, parameters, false, true)
|
||||||
|
local promise = promise.new()
|
||||||
|
Ox:transaction(queries, parameters, function(result)
|
||||||
|
promise:resolve(result)
|
||||||
|
end)
|
||||||
|
return Citizen.Await(promise)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param query string
|
||||||
|
---@return integer result
|
||||||
|
---returns the id used to reference a stored query string
|
||||||
|
MySQL.Sync.store = function(query)
|
||||||
|
assert(type(query) == 'string', 'The SQL Query must be a string')
|
||||||
|
local store = #Store+1
|
||||||
|
Store[store] = query
|
||||||
|
return store
|
||||||
|
end
|
||||||
|
|
||||||
|
MySQL.ready = function(cb)
|
||||||
|
CreateThread(function()
|
||||||
|
repeat
|
||||||
|
Wait(50)
|
||||||
|
until GetResourceState('oxmysql') == 'started'
|
||||||
|
cb()
|
||||||
|
end)
|
||||||
|
end
|
||||||
+131
@@ -0,0 +1,131 @@
|
|||||||
|
local oxmysql = exports.oxmysql
|
||||||
|
|
||||||
|
CreateThread(function()
|
||||||
|
Wait(1000)
|
||||||
|
local resource = GetCurrentResourceName()
|
||||||
|
local url = GetResourceMetadata(resource, 'url', 0)
|
||||||
|
local version = GetResourceMetadata(resource, 'version', 0)
|
||||||
|
|
||||||
|
PerformHttpRequest(('%s/main/lua/fxmanifest.lua'):format(url:gsub('github.com', 'raw.githubusercontent.com')), function(error, response)
|
||||||
|
if error == 200 then
|
||||||
|
local latest = response:match('%d%.%d+%.%d+')
|
||||||
|
if version ~= latest then
|
||||||
|
local curMajor, curMinor = string.strsplit('.', version)
|
||||||
|
local newMajor, newMinor = string.strsplit('.', response:match('%d%.%d+%.%d+'))
|
||||||
|
local link = ('%s/releases/download/v%s/oxmysql-v%s.zip'):format(url, latest, latest)
|
||||||
|
|
||||||
|
if tonumber(curMajor) < tonumber(newMajor) then
|
||||||
|
latest = 'A major update'
|
||||||
|
elseif tonumber(curMinor) < tonumber(newMinor) then
|
||||||
|
latest = 'An update'
|
||||||
|
else
|
||||||
|
latest = 'A patch'
|
||||||
|
end
|
||||||
|
|
||||||
|
print(('^3%s is available for oxmysql - please update to the latest release (current version: %s)\n ^3- %s^0'):format(latest, version, link))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end, 'GET')
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Check for a recent native since the recommended artifact doesn't support JS async_retval or dependency constraints
|
||||||
|
if not GetEntityAttachedTo then
|
||||||
|
|
||||||
|
---@param query string
|
||||||
|
---@param parameters? table
|
||||||
|
---@return integer result
|
||||||
|
---returns array of matching rows or result data
|
||||||
|
exports('executeSync', function(query, parameters)
|
||||||
|
local p = promise.new()
|
||||||
|
oxmysql:execute(query, parameters, function(result)
|
||||||
|
p:resolve(result)
|
||||||
|
end, GetInvokingResource())
|
||||||
|
return Citizen.Await(p)
|
||||||
|
end)
|
||||||
|
|
||||||
|
---@param query string
|
||||||
|
---@param parameters? table
|
||||||
|
---@return table result
|
||||||
|
---returns array of matching rows or result data
|
||||||
|
exports('fetchSync', function(query, parameters)
|
||||||
|
local p = promise.new()
|
||||||
|
oxmysql:fetch(query, parameters, function(result)
|
||||||
|
p:resolve(result)
|
||||||
|
end, GetInvokingResource())
|
||||||
|
return Citizen.Await(p)
|
||||||
|
end)
|
||||||
|
|
||||||
|
---@param query string
|
||||||
|
---@param parameters? table
|
||||||
|
---@return table result
|
||||||
|
---returns table containing key value pairs
|
||||||
|
exports('singleSync', function(query, parameters)
|
||||||
|
local p = promise.new()
|
||||||
|
oxmysql:single(query, parameters, function(result)
|
||||||
|
p:resolve(result)
|
||||||
|
end, GetInvokingResource())
|
||||||
|
return Citizen.Await(p)
|
||||||
|
end)
|
||||||
|
|
||||||
|
---@param query string
|
||||||
|
---@param parameters? table
|
||||||
|
---@return integer|string
|
||||||
|
---returns value of the first column of a single row
|
||||||
|
exports('scalarSync', function(query, parameters)
|
||||||
|
local p = promise.new()
|
||||||
|
oxmysql:scalar(query, parameters, function(result)
|
||||||
|
p:resolve(result)
|
||||||
|
end, GetInvokingResource())
|
||||||
|
return Citizen.Await(p)
|
||||||
|
end)
|
||||||
|
|
||||||
|
---@param query string
|
||||||
|
---@param parameters? table
|
||||||
|
---@return table result
|
||||||
|
---returns the last inserted id
|
||||||
|
exports('insertSync', function(query, parameters)
|
||||||
|
local p = promise.new()
|
||||||
|
oxmysql:insert(query, parameters, function(result)
|
||||||
|
p:resolve(result)
|
||||||
|
end, GetInvokingResource())
|
||||||
|
return Citizen.Await(p)
|
||||||
|
end)
|
||||||
|
|
||||||
|
---@param query string
|
||||||
|
---@param parameters? table
|
||||||
|
---@return integer result
|
||||||
|
---returns number of rows updated by the executed query
|
||||||
|
exports('updateSync', function(query, parameters)
|
||||||
|
local p = promise.new()
|
||||||
|
oxmysql:update(query, parameters, function(result)
|
||||||
|
p:resolve(result)
|
||||||
|
end, GetInvokingResource())
|
||||||
|
return Citizen.Await(p)
|
||||||
|
end)
|
||||||
|
|
||||||
|
---@param queries table
|
||||||
|
---@param parameters? table
|
||||||
|
---@return boolean result
|
||||||
|
---returns true when the transaction has succeeded
|
||||||
|
exports('transactionSync', function(queries, parameters)
|
||||||
|
local p = promise.new()
|
||||||
|
oxmysql:transaction(queries, parameters, function(result)
|
||||||
|
p:resolve(result)
|
||||||
|
end, GetInvokingResource())
|
||||||
|
return Citizen.Await(p)
|
||||||
|
end)
|
||||||
|
|
||||||
|
---@param query string
|
||||||
|
---@param parameters table
|
||||||
|
---@return any result
|
||||||
|
---supports SELECT, INSERT, UPDATE, and DELETE
|
||||||
|
---
|
||||||
|
---return value is based on the number of results and the type of query used
|
||||||
|
exports('prepareSync', function(query, parameters)
|
||||||
|
local p = promise.new()
|
||||||
|
oxmysql:prepare(query, parameters, function(result)
|
||||||
|
p:resolve(result)
|
||||||
|
end, GetInvokingResource())
|
||||||
|
return Citizen.Await(p)
|
||||||
|
end)
|
||||||
|
end
|
||||||
-78
@@ -1,78 +0,0 @@
|
|||||||
/// <reference path="node_modules\@citizenfx\server\index.d.ts" />
|
|
||||||
const { createPool } = require('mysql2/promise');
|
|
||||||
const { ConnectionStringParser } = require('connection-string-parser');
|
|
||||||
|
|
||||||
const connectionStringParser = new ConnectionStringParser({
|
|
||||||
scheme: 'mysql',
|
|
||||||
hosts: []
|
|
||||||
});
|
|
||||||
|
|
||||||
const connectionString = GetConvar('mysql_connection_string', '');
|
|
||||||
|
|
||||||
if(connectionString === '') throw new Error(`Undefined convar mysql_connection_string`);
|
|
||||||
|
|
||||||
const config = connectionStringParser.parse(connectionString);
|
|
||||||
|
|
||||||
//TODO: semicolor format
|
|
||||||
|
|
||||||
const slowQueryWarning = GetConvarInt('mysql_slow_query_warning', 100)
|
|
||||||
|
|
||||||
const pool = createPool({
|
|
||||||
host: config.hosts[0].host,
|
|
||||||
user: config.username,
|
|
||||||
password: config.password,
|
|
||||||
database: config.endpoint,
|
|
||||||
charset: 'utf8mb4_unicode_ci',
|
|
||||||
multipleStatements: false,
|
|
||||||
namedPlaceholders: true,
|
|
||||||
waitForConnections: true,
|
|
||||||
connectionLimit: 10,
|
|
||||||
queueLimit: 0,
|
|
||||||
...config.options
|
|
||||||
});
|
|
||||||
|
|
||||||
const execute = async (query, parameters) => {
|
|
||||||
ScheduleResourceTick(GetCurrentResourceName());
|
|
||||||
try {
|
|
||||||
const startTime = process.hrtime.bigint();
|
|
||||||
const [result] = await pool.execute(query, parameters);
|
|
||||||
const executionTime = new Number((process.hrtime.bigint() - startTime)) / 1000000
|
|
||||||
|
|
||||||
if(executionTime >= slowQueryWarning)
|
|
||||||
console.warn(`${query} took ${executionTime}ms!`)
|
|
||||||
|
|
||||||
return result;
|
|
||||||
} catch (error) {
|
|
||||||
return console.error(error.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
global.exports("execute", (query, parameters, callback = () => { }) => {
|
|
||||||
execute(query, parameters).then(result =>
|
|
||||||
callback(result && result.affectedRows)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
global.exports("fetch", (query, parameters, callback = () => { }) => {
|
|
||||||
execute(query, parameters).then(result =>
|
|
||||||
callback(result)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
global.exports("single", (query, parameters, callback = () => { }) => {
|
|
||||||
execute(query, parameters).then(result =>
|
|
||||||
callback(result && result[0])
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
global.exports("scalar", (query, parameters, callback = () => { }) => {
|
|
||||||
execute(query, parameters).then(result =>
|
|
||||||
callback(result && result[0] && Object.values(result[0])[0])
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
global.exports("insert", (query, parameters, callback = () => { }) => {
|
|
||||||
execute(query, parameters).then(result =>
|
|
||||||
callback(result && result.insertId)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
+17
-6
@@ -1,15 +1,26 @@
|
|||||||
{
|
{
|
||||||
"name": "oxmysql",
|
"name": "oxmysql",
|
||||||
"private": "true",
|
"version": "1.0.0",
|
||||||
"version": "0.1.0",
|
|
||||||
"main": "oxmysql.js",
|
"main": "oxmysql.js",
|
||||||
"description": "FiveM MySQL wrapper using faster mysql2",
|
"description": "node-mysql2 resource for Cfx",
|
||||||
"repository": "[email protected]:overextended/oxmysql.git",
|
"repository": "[email protected]:overextended/oxmysql.git",
|
||||||
"author": "dunak-debug <[email protected]>",
|
"author": "dunak-debug <[email protected]>",
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
|
"scripts": {
|
||||||
|
"build": "webpack",
|
||||||
|
"watch": "webpack --watch",
|
||||||
|
"postinstall": "patch-package"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@citizenfx/server": "^2.0.4376-1",
|
"@citizenfx/server": "latest",
|
||||||
"connection-string-parser": "^1.0.4",
|
"mysql2": "^2.3.3",
|
||||||
"mysql2": "^2.3.0"
|
"postinstall-postinstall": "^2.1.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"copy-webpack-plugin": "^10.0.0",
|
||||||
|
"patch-package": "^6.4.7",
|
||||||
|
"typescript": "^4.5.2",
|
||||||
|
"webpack": "^5.64.4",
|
||||||
|
"webpack-cli": "^4.9.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
diff --git a/node_modules/mysql2/lib/connection_config.js b/node_modules/mysql2/lib/connection_config.js
|
||||||
|
index 11ad01b..6fab74e 100644
|
||||||
|
--- a/node_modules/mysql2/lib/connection_config.js
|
||||||
|
+++ b/node_modules/mysql2/lib/connection_config.js
|
||||||
|
@@ -187,7 +187,6 @@ class ConnectionConfig {
|
||||||
|
'LONG_PASSWORD',
|
||||||
|
'FOUND_ROWS',
|
||||||
|
'LONG_FLAG',
|
||||||
|
- 'CONNECT_WITH_DB',
|
||||||
|
'ODBC',
|
||||||
|
'LOCAL_FILES',
|
||||||
|
'IGNORE_SPACE',
|
||||||
|
@@ -200,15 +199,14 @@ class ConnectionConfig {
|
||||||
|
'TRANSACTIONS',
|
||||||
|
'SESSION_TRACK'
|
||||||
|
];
|
||||||
|
- if (options && options.multipleStatements) {
|
||||||
|
- defaultFlags.push('MULTI_STATEMENTS');
|
||||||
|
+ if (options) {
|
||||||
|
+ if (options.multipleStatements) defaultFlags.push('MULTI_STATEMENTS');
|
||||||
|
+ if (options.database) defaultFlags.push('CONNECT_WITH_DB');
|
||||||
|
+ if (options.connectAttributes) defaultFlags.push('CONNECT_ATTRS')
|
||||||
|
}
|
||||||
|
defaultFlags.push('PLUGIN_AUTH');
|
||||||
|
defaultFlags.push('PLUGIN_AUTH_LENENC_CLIENT_DATA');
|
||||||
|
|
||||||
|
- if (options && options.connectAttributes) {
|
||||||
|
- defaultFlags.push('CONNECT_ATTRS');
|
||||||
|
- }
|
||||||
|
return defaultFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/node_modules/mysql2/lib/packets/execute.js b/node_modules/mysql2/lib/packets/execute.js
|
||||||
|
index c612f66..02dbe22 100644
|
||||||
|
--- a/node_modules/mysql2/lib/packets/execute.js
|
||||||
|
+++ b/node_modules/mysql2/lib/packets/execute.js
|
||||||
|
@@ -28,7 +28,9 @@ function toParameter(value, encoding, timezone) {
|
||||||
|
if (value !== null) {
|
||||||
|
switch (typeof value) {
|
||||||
|
case 'undefined':
|
||||||
|
- throw new TypeError('Bind parameters must not contain undefined');
|
||||||
|
+ value = '';
|
||||||
|
+ type = Types.NULL;
|
||||||
|
+ break
|
||||||
|
|
||||||
|
case 'number':
|
||||||
|
type = Types.DOUBLE;
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
diff --git a/node_modules/named-placeholders/index.js b/node_modules/named-placeholders/index.js
|
||||||
|
index 527d723..f63ce28 100644
|
||||||
|
--- a/node_modules/named-placeholders/index.js
|
||||||
|
+++ b/node_modules/named-placeholders/index.js
|
||||||
|
@@ -3,7 +3,7 @@
|
||||||
|
// based on code from Brian White @mscdex mariasql library - https://github.com/mscdex/node-mariasql/blob/master/lib/Client.js#L272-L332
|
||||||
|
// License: https://github.com/mscdex/node-mariasql/blob/master/LICENSE
|
||||||
|
|
||||||
|
-const RE_PARAM = /(?:\?)|(?::(\d+|(?:[a-zA-Z][a-zA-Z0-9_]*)))/g,
|
||||||
|
+const RE_PARAM = /(?:\?)|(?:(?<!["'])[:@](\d+|(?:[a-zA-Z][a-zA-Z0-9_]*)))/g,
|
||||||
|
DQUOTE = 34,
|
||||||
|
SQUOTE = 39,
|
||||||
|
BSLASH = 92;
|
||||||
|
@@ -94,15 +94,22 @@ function createCompiler(config) {
|
||||||
|
if (typeof params == 'undefined')
|
||||||
|
throw new Error('Named query contains placeholders, but parameters object is undefined');
|
||||||
|
|
||||||
|
+ for(const key in params) {
|
||||||
|
+ if(key.charAt(0) === '@' || key.charAt(0) === ':') {
|
||||||
|
+ params[key.substring(1)] = params[key];
|
||||||
|
+ delete params[key];
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
const tokens = tree[1];
|
||||||
|
for (let i=0; i < tokens.length; ++i) {
|
||||||
|
- arr.push(params[tokens[i]]);
|
||||||
|
+ arr.push(params[tokens[i]] === undefined ? null : params[tokens[i]]);
|
||||||
|
}
|
||||||
|
return [tree[0], arr];
|
||||||
|
}
|
||||||
|
|
||||||
|
function noTailingSemicolon(s) {
|
||||||
|
- if (s.slice(-1) == ':') {
|
||||||
|
+ if (s.slice(-1) == ':' || s.slice(-1) == '@') {
|
||||||
|
return s.slice(0, -1);
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
@@ -115,7 +122,7 @@ function createCompiler(config) {
|
||||||
|
|
||||||
|
let unnamed = noTailingSemicolon(tree[0][0]);
|
||||||
|
for (let i=1; i < tree[0].length; ++i) {
|
||||||
|
- if (tree[0][i-1].slice(-1) == ':') {
|
||||||
|
+ if (tree[0][i-1].slice(-1) == ':' || tree[0][i-1].slice(-1) == '@') {
|
||||||
|
unnamed += config.placeholder;
|
||||||
|
}
|
||||||
|
unnamed += config.placeholder;
|
||||||
|
@@ -124,7 +131,7 @@ function createCompiler(config) {
|
||||||
|
|
||||||
|
const last = tree[0][tree[0].length -1];
|
||||||
|
if (tree[0].length == tree[1].length) {
|
||||||
|
- if (last.slice(-1) == ':') {
|
||||||
|
+ if (last.slice(-1) == ':' || last.slice(-1) == '@') {
|
||||||
|
unnamed += config.placeholder;
|
||||||
|
}
|
||||||
|
unnamed += config.placeholder;
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
const slowQueryWarning = GetConvarInt('mysql_slow_query_warning', 150);
|
||||||
|
const debug = GetConvar('mysql_debug', 'false') === 'true';
|
||||||
|
|
||||||
|
const isolationLevel = (() => {
|
||||||
|
switch (GetConvarInt('mysql_transaction_isolation_level', 2)) {
|
||||||
|
case 1:
|
||||||
|
return 'SET TRANSACTION ISOLATION LEVEL REPEATABLE READ';
|
||||||
|
case 2:
|
||||||
|
return 'SET TRANSACTION ISOLATION LEVEL READ COMMITTED';
|
||||||
|
case 3:
|
||||||
|
return 'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED';
|
||||||
|
case 4:
|
||||||
|
return 'SET TRANSACTION ISOLATION LEVEL SERIALIZABLE';
|
||||||
|
default:
|
||||||
|
return 'SET TRANSACTION ISOLATION LEVEL READ COMMITTED';
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
const resourceName = GetCurrentResourceName();
|
||||||
|
|
||||||
|
export { slowQueryWarning, debug, isolationLevel, resourceName };
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
class FormatError extends Error {
|
||||||
|
constructor(message, query, parameters) {
|
||||||
|
super(message);
|
||||||
|
if (parameters) this.sql = `${query} ${JSON.stringify(parameters)}`;
|
||||||
|
else this.sql = query;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export { FormatError };
|
||||||
+102
@@ -0,0 +1,102 @@
|
|||||||
|
import { pool } from './pool';
|
||||||
|
import { parseParameters } from './parser';
|
||||||
|
import { slowQueryWarning, debug, resourceName } from './config';
|
||||||
|
import { FormatError } from './errors';
|
||||||
|
|
||||||
|
const execute = async (query, parameters, resource) => {
|
||||||
|
try {
|
||||||
|
[query, parameters] = parseParameters(query, parameters);
|
||||||
|
const connection = await pool.getConnection();
|
||||||
|
ScheduleResourceTick(resourceName);
|
||||||
|
|
||||||
|
const startTime = process.hrtime();
|
||||||
|
const [rows] = await connection.query(query, parameters);
|
||||||
|
const executionTime = process.hrtime(startTime)[1] / 1000000; // nanosecond to millisecond
|
||||||
|
|
||||||
|
if (executionTime >= slowQueryWarning || debug)
|
||||||
|
console.log(
|
||||||
|
`^3[${debug ? 'DEBUG' : 'WARNING'}] ${resource} took ${executionTime}ms to execute a query!
|
||||||
|
${query} ${JSON.stringify(parameters)}^0`
|
||||||
|
);
|
||||||
|
|
||||||
|
connection.release();
|
||||||
|
return rows;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(
|
||||||
|
`^1[ERROR] ${resource} was unable to execute a query!
|
||||||
|
${error.message}
|
||||||
|
${error.sql || `${query} ${JSON.stringify(parameters)}`}^0`
|
||||||
|
);
|
||||||
|
debug && console.trace(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const queryType = (query) => {
|
||||||
|
switch (query.replace(/\s.*/, '')) {
|
||||||
|
case 'SELECT':
|
||||||
|
return 1;
|
||||||
|
case 'INSERT':
|
||||||
|
return 2;
|
||||||
|
case 'UPDATE':
|
||||||
|
return 3;
|
||||||
|
case 'DELETE':
|
||||||
|
return 3;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const preparedStatement = async (query, parameters, resource) => {
|
||||||
|
try {
|
||||||
|
if (!Array.isArray(parameters))
|
||||||
|
throw new FormatError(`Placeholders were defined, but query received no parameters!`, query);
|
||||||
|
|
||||||
|
if (typeof query !== 'string') throw new FormatError(`Prepared statements must utilise a single query`);
|
||||||
|
|
||||||
|
const type = queryType(query);
|
||||||
|
if (!type) throw new FormatError(`Prepared statements only accept SELECT, INSERT, UPDATE, and DELETE methods!`);
|
||||||
|
|
||||||
|
const connection = await pool.getConnection();
|
||||||
|
ScheduleResourceTick(resourceName);
|
||||||
|
|
||||||
|
const results = [];
|
||||||
|
let queryCount = parameters.length;
|
||||||
|
const startTime = process.hrtime();
|
||||||
|
|
||||||
|
for (let i = 0; i < queryCount; i++) {
|
||||||
|
const [rows] = await connection.execute(query, parameters[i]);
|
||||||
|
results[i] = rows && (type === 3 ? rows.affectedRows : type === 2 ? rows.insertId : rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
const executionTime = process.hrtime(startTime)[1] / 1000000; // nanosecond to millisecond
|
||||||
|
if (executionTime >= slowQueryWarning || debug)
|
||||||
|
console.log(
|
||||||
|
`^3[${debug ? 'DEBUG' : 'WARNING'}] ${resource} took ${totalTime}ms to execute ${
|
||||||
|
queryCount > 1 ? queryCount + ' queries' : 'a query'
|
||||||
|
}!
|
||||||
|
${query} ${JSON.stringify(parameters)}^0`
|
||||||
|
);
|
||||||
|
|
||||||
|
connection.release();
|
||||||
|
|
||||||
|
if (results.length === 1) {
|
||||||
|
if (type === 1) {
|
||||||
|
if (results[0][0] && Object.keys(results[0][0]).length === 1) {
|
||||||
|
return Object.values(results[0][0])[0];
|
||||||
|
}
|
||||||
|
return results[0][0];
|
||||||
|
}
|
||||||
|
return results[0];
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(
|
||||||
|
`^1[ERROR] ${resource} was unable to execute a query!
|
||||||
|
${error.message}
|
||||||
|
${error.sql || `${query} ${JSON.stringify(parameters)}`}^0`
|
||||||
|
);
|
||||||
|
debug && console.trace(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export { execute, preparedStatement };
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
import { pool } from './pool';
|
||||||
|
import { execute, preparedStatement } from './execute';
|
||||||
|
import { transaction } from './transaction';
|
||||||
|
import { debug, isolationLevel } from './config';
|
||||||
|
|
||||||
|
setImmediate(async () => {
|
||||||
|
try {
|
||||||
|
await pool.query(isolationLevel);
|
||||||
|
console.log(`^2Database server connection established!^0`);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(`^3Unable to establish a connection to the database! [${error.code}]\n${error.message}^0`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const safeCallback = (callback, result) => {
|
||||||
|
if (typeof callback === 'function') callback(result);
|
||||||
|
};
|
||||||
|
|
||||||
|
global.exports('execute', (query, parameters, cb, resource = GetInvokingResource()) => {
|
||||||
|
execute(query, parameters, resource).then((result) => safeCallback(cb || parameters, result));
|
||||||
|
});
|
||||||
|
|
||||||
|
global.exports('insert', (query, parameters, cb, resource = GetInvokingResource()) => {
|
||||||
|
execute(query, parameters, resource).then((result) => safeCallback(cb || parameters, result && result.insertId));
|
||||||
|
});
|
||||||
|
|
||||||
|
global.exports('update', (query, parameters, cb, resource = GetInvokingResource()) => {
|
||||||
|
execute(query, parameters, resource).then((result) => safeCallback(cb || parameters, result && result.affectedRows));
|
||||||
|
});
|
||||||
|
|
||||||
|
global.exports('fetch', (query, parameters, cb, resource = GetInvokingResource()) => {
|
||||||
|
execute(query, parameters, resource).then((result) => safeCallback(cb || parameters, result));
|
||||||
|
});
|
||||||
|
|
||||||
|
global.exports('single', (query, parameters, cb, resource = GetInvokingResource()) => {
|
||||||
|
execute(query, parameters, resource).then((result) => safeCallback(cb || parameters, result && result[0]));
|
||||||
|
});
|
||||||
|
|
||||||
|
global.exports('scalar', (query, parameters, cb, resource = GetInvokingResource()) => {
|
||||||
|
execute(query, parameters, resource).then((result) =>
|
||||||
|
safeCallback(cb || parameters, result && result[0] && Object.values(result[0])[0])
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
global.exports('transaction', (queries, parameters, cb, resource = GetInvokingResource()) => {
|
||||||
|
transaction(queries, parameters, resource).then((result) => {
|
||||||
|
safeCallback(cb || parameters, result || false, resource, debug && JSON.stringify(queries));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
global.exports('prepare', (query, parameters, cb, resource = GetInvokingResource()) => {
|
||||||
|
preparedStatement(query, parameters, resource).then((result) => safeCallback(cb || parameters, result));
|
||||||
|
});
|
||||||
|
|
||||||
|
if (GetEntityAttachedTo || !GetResourceMetadata(GetCurrentResourceName(), 'server_script', 1)) {
|
||||||
|
global.exports('prepareSync', async (query, parameters) => {
|
||||||
|
const result = await preparedStatement(query, parameters, GetInvokingResource());
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
|
||||||
|
global.exports('executeSync', async (query, parameters) => {
|
||||||
|
const result = await execute(query, parameters, GetInvokingResource());
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
|
||||||
|
global.exports('insertSync', async (query, parameters) => {
|
||||||
|
const result = await execute(query, parameters, GetInvokingResource());
|
||||||
|
return result && result.insertId;
|
||||||
|
});
|
||||||
|
|
||||||
|
global.exports('updateSync', async (query, parameters) => {
|
||||||
|
const result = await execute(query, parameters, GetInvokingResource());
|
||||||
|
return result && result.affectedRows;
|
||||||
|
});
|
||||||
|
|
||||||
|
global.exports('fetchSync', async (query, parameters) => {
|
||||||
|
const result = await execute(query, parameters, GetInvokingResource());
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
|
||||||
|
global.exports('singleSync', async (query, parameters) => {
|
||||||
|
const result = await execute(query, parameters, GetInvokingResource());
|
||||||
|
return result && result[0];
|
||||||
|
});
|
||||||
|
|
||||||
|
global.exports('scalarSync', async (query, parameters) => {
|
||||||
|
const result = await execute(query, parameters, GetInvokingResource());
|
||||||
|
return result && result[0] && Object.values(result[0])[0];
|
||||||
|
});
|
||||||
|
|
||||||
|
global.exports('transactionSync', async (queries, parameters) => {
|
||||||
|
const result = await transaction(queries, parameters, GetInvokingResource());
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
import { FormatError } from './errors';
|
||||||
|
import * as createCompiler from 'named-placeholders';
|
||||||
|
|
||||||
|
const convertNamedPlaceholders = createCompiler();
|
||||||
|
|
||||||
|
// DATE compatibility with mysql-async
|
||||||
|
// https://github.com/brouznouf/fivem-mysql-async/blob/master/mysql-async.js#L15499-L15536
|
||||||
|
const parseTypes = (field, next) => {
|
||||||
|
switch (field.type) {
|
||||||
|
case 'DATETIME':
|
||||||
|
case 'DATETIME2':
|
||||||
|
case 'TIMESTAMP':
|
||||||
|
case 'TIMESTAMP2':
|
||||||
|
case 'NEWDATE':
|
||||||
|
case 'DATE':
|
||||||
|
return field.type === 'DATE'
|
||||||
|
? new Date(field.string() + ' 00:00:00').getTime()
|
||||||
|
: new Date(field.string()).getTime();
|
||||||
|
case 'TINY':
|
||||||
|
return field.length === 1 ? field.string() === '1' : next();
|
||||||
|
case 'BIT':
|
||||||
|
return field.buffer()[0] === 1;
|
||||||
|
default:
|
||||||
|
return next();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const parseParameters = (query, parameters) => {
|
||||||
|
if (typeof query !== 'string')
|
||||||
|
throw new Error(
|
||||||
|
`Non-string query passed. Make sure you use "oxmysql:execute" instead of "oxmysql.execute" when calling exports.`
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!parameters || typeof parameters === 'function') return [query, []];
|
||||||
|
|
||||||
|
if (query.includes('@') || query.includes(':')) {
|
||||||
|
const obj =
|
||||||
|
parameters.length !== 0
|
||||||
|
? parameters
|
||||||
|
: (() => {
|
||||||
|
let obj = {};
|
||||||
|
const [_, paramNames] = convertNamedPlaceholders.parse(query);
|
||||||
|
if (paramNames) {
|
||||||
|
for (let i = 0; i < paramNames.length; i++) obj[paramNames[i]] = null;
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
})();
|
||||||
|
|
||||||
|
return [query, obj];
|
||||||
|
}
|
||||||
|
|
||||||
|
const queryParams = query.match(/\?(?!\?)/g);
|
||||||
|
|
||||||
|
if (queryParams === null) return [query, []];
|
||||||
|
|
||||||
|
if (parameters === undefined)
|
||||||
|
throw new FormatError(`Placeholders were defined, but query received no parameters!`, query);
|
||||||
|
|
||||||
|
if (!Array.isArray(parameters)) {
|
||||||
|
let arr = [];
|
||||||
|
Object.entries(parameters).forEach((entry) => {
|
||||||
|
const [key, value] = entry;
|
||||||
|
arr[key - 1] = value;
|
||||||
|
});
|
||||||
|
parameters = arr;
|
||||||
|
}
|
||||||
|
if (Array.isArray(parameters)) {
|
||||||
|
if (parameters.length === 0) {
|
||||||
|
for (let i = 0; i < queryParams.length; i++) parameters[i] = null;
|
||||||
|
return [query, parameters];
|
||||||
|
}
|
||||||
|
const diff = queryParams.length - parameters.length;
|
||||||
|
if (diff > 0) {
|
||||||
|
for (let i = 0; i < diff; i++) parameters[queryParams.length + i] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [query, parameters];
|
||||||
|
};
|
||||||
|
|
||||||
|
const parseTransaction = (queries, parameters) => {
|
||||||
|
//https://github.com/GHMatti/ghmattimysql/blob/37f1d2ae5c53f91782d168fe81fba80512d3c46d/packages/ghmattimysql/src/server/utility/sanitizeTransactionInput.ts#L5
|
||||||
|
|
||||||
|
if (!Array.isArray(queries)) throw new Error(`Transaction queries must be array type`);
|
||||||
|
|
||||||
|
const parsedTransaction = queries.map((query) => {
|
||||||
|
const [parsedQuery, parsedParameters] = parseParameters(
|
||||||
|
typeof query === 'object' ? query.query : query,
|
||||||
|
(typeof query === 'object' && (query.parameters || query.values)) || parameters || []
|
||||||
|
);
|
||||||
|
return { query: parsedQuery, params: parsedParameters };
|
||||||
|
});
|
||||||
|
|
||||||
|
return parsedTransaction;
|
||||||
|
};
|
||||||
|
|
||||||
|
export { parseTypes, parseParameters, parseTransaction };
|
||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
import { createPool } from 'mysql2/promise';
|
||||||
|
import { parseTypes } from './parser';
|
||||||
|
|
||||||
|
const connectionString = GetConvar('mysql_connection_string', '');
|
||||||
|
|
||||||
|
if (connectionString === '') {
|
||||||
|
throw new Error(`Set up mysql_connection_string in server.cfg`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const dbOptions = (() => {
|
||||||
|
const options = connectionString.includes('mysql://')
|
||||||
|
? { uri: connectionString }
|
||||||
|
: (options = connectionString
|
||||||
|
.replace(/(?:host(?:name)|ip|server|data\s?source|addr(?:ess)?)=/gi, 'host=')
|
||||||
|
.replace(/(?:user\s?(?:id|name)?|uid)=/gi, 'user=')
|
||||||
|
.replace(/(?:pwd|pass)=/gi, 'password=')
|
||||||
|
.replace(/(?:db)=/gi, 'database=')
|
||||||
|
.split(';')
|
||||||
|
.reduce((connectionInfo, parameter) => {
|
||||||
|
const [key, value] = parameter.split('=');
|
||||||
|
connectionInfo[key] = value;
|
||||||
|
return connectionInfo;
|
||||||
|
}, {}));
|
||||||
|
|
||||||
|
options.namedPlaceholders = true;
|
||||||
|
options.typeCast = parseTypes;
|
||||||
|
|
||||||
|
return options;
|
||||||
|
})();
|
||||||
|
|
||||||
|
export const pool = createPool(dbOptions);
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import { pool } from './pool';
|
||||||
|
import { parseTransaction } from './parser';
|
||||||
|
import { slowQueryWarning, debug, resourceName } from './config';
|
||||||
|
|
||||||
|
const transactionError = (queries, parameters) =>
|
||||||
|
`${queries
|
||||||
|
.map((query) =>
|
||||||
|
typeof query === 'string' ? query : `${query.query} ${JSON.stringify(query.values || query.parameters || [])}`
|
||||||
|
)
|
||||||
|
.join('\n')}\n${JSON.stringify(parameters)}`;
|
||||||
|
|
||||||
|
const transaction = async (queries, parameters, resource) => {
|
||||||
|
ScheduleResourceTick(resourceName);
|
||||||
|
const connection = await pool.getConnection();
|
||||||
|
try {
|
||||||
|
const startTime = process.hrtime();
|
||||||
|
|
||||||
|
const fullQuery = parseTransaction(queries, parameters);
|
||||||
|
const transactionAmount = fullQuery.length;
|
||||||
|
|
||||||
|
await connection.beginTransaction();
|
||||||
|
|
||||||
|
for (let i = 0; i < transactionAmount; i++) {
|
||||||
|
await connection.query(fullQuery[i].query, fullQuery[i].params);
|
||||||
|
}
|
||||||
|
|
||||||
|
await connection.commit();
|
||||||
|
|
||||||
|
const executionTime = process.hrtime(startTime)[1] / 1000000;
|
||||||
|
|
||||||
|
if (executionTime >= slowQueryWarning * transactionAmount || debug)
|
||||||
|
console.log(
|
||||||
|
`^3[${
|
||||||
|
debug ? 'DEBUG' : 'WARNING'
|
||||||
|
}] ${resource} took ${executionTime}ms to execute a transaction!\n${transactionError(queries, parameters)}^0`
|
||||||
|
);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} catch (error) {
|
||||||
|
await connection.rollback();
|
||||||
|
console.log(
|
||||||
|
`^1[ERROR] ${resource} was unable to execute a transaction!
|
||||||
|
${error.message}
|
||||||
|
${error.sql || `${transactionError(queries, parameters)}`}^0`
|
||||||
|
);
|
||||||
|
debug && console.trace(error);
|
||||||
|
} finally {
|
||||||
|
connection.release();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export { transaction };
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
const path = require("path");
|
||||||
|
const { DefinePlugin, IgnorePlugin } = require("webpack");
|
||||||
|
const CopyPlugin = require("copy-webpack-plugin");
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
mode: "production",
|
||||||
|
entry: "./src/index.js",
|
||||||
|
resolve: {
|
||||||
|
extensions: [".js"],
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new DefinePlugin({ "global.GENTLY": false }),
|
||||||
|
new IgnorePlugin({
|
||||||
|
resourceRegExp: /^cardinal$/,
|
||||||
|
contextRegExp: /./,
|
||||||
|
}),
|
||||||
|
new CopyPlugin({
|
||||||
|
patterns: ["./lua", "./lua", "README.md", "LICENSE.md"],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
output: {
|
||||||
|
filename: "oxmysql.js",
|
||||||
|
path: path.resolve(__dirname, "dist"),
|
||||||
|
},
|
||||||
|
optimization: {
|
||||||
|
minimize: false,
|
||||||
|
},
|
||||||
|
target: "node",
|
||||||
|
};
|
||||||
-84
@@ -1,84 +0,0 @@
|
|||||||
---
|
|
||||||
-- Execute query and fetch affected rows
|
|
||||||
--
|
|
||||||
-- @param query tring
|
|
||||||
-- @param parameters table
|
|
||||||
--
|
|
||||||
-- @return table with result
|
|
||||||
--
|
|
||||||
local function executeSync(query, parameters)
|
|
||||||
local p = promise.new()
|
|
||||||
exports['oxmysql']:execute(query, parameters, function(result)
|
|
||||||
p:resolve(result)
|
|
||||||
end)
|
|
||||||
return Citizen.Await(p)
|
|
||||||
end
|
|
||||||
exports('executeSync', executeSync)
|
|
||||||
|
|
||||||
---
|
|
||||||
-- Execute query and fetch all result
|
|
||||||
--
|
|
||||||
-- @param query tring
|
|
||||||
-- @param parameters table
|
|
||||||
--
|
|
||||||
-- @return table with result
|
|
||||||
--
|
|
||||||
local function fetchSync(query, parameters)
|
|
||||||
local p = promise.new()
|
|
||||||
exports['oxmysql']:fetch(query, parameters, function(result)
|
|
||||||
p:resolve(result)
|
|
||||||
end)
|
|
||||||
return Citizen.Await(p)
|
|
||||||
end
|
|
||||||
exports('fetchSync', fetchSync)
|
|
||||||
|
|
||||||
---
|
|
||||||
-- Execute query and fetch first row
|
|
||||||
--
|
|
||||||
-- @param query tring
|
|
||||||
-- @param parameters table
|
|
||||||
--
|
|
||||||
-- @return table with result row
|
|
||||||
--
|
|
||||||
local function singleSync(query, parameters)
|
|
||||||
local p = promise.new()
|
|
||||||
exports['oxmysql']:single(query, parameters, function(result)
|
|
||||||
p:resolve(result)
|
|
||||||
end)
|
|
||||||
return Citizen.Await(p)
|
|
||||||
end
|
|
||||||
exports('singleSync', singleSync)
|
|
||||||
|
|
||||||
---
|
|
||||||
-- Execute query and fetch first column of first row
|
|
||||||
--
|
|
||||||
-- @param query tring
|
|
||||||
-- @param parameters table
|
|
||||||
--
|
|
||||||
-- @return result
|
|
||||||
--
|
|
||||||
local function scalarSync(query, parameters)
|
|
||||||
local p = promise.new()
|
|
||||||
exports['oxmysql']:scalar(query, parameters, function(result)
|
|
||||||
p:resolve(result)
|
|
||||||
end)
|
|
||||||
return Citizen.Await(p)
|
|
||||||
end
|
|
||||||
exports('scalarSync', scalarSync)
|
|
||||||
|
|
||||||
---
|
|
||||||
-- Insert data and return inserted id
|
|
||||||
--
|
|
||||||
-- @param query tring
|
|
||||||
-- @param parameters table
|
|
||||||
--
|
|
||||||
-- @return insert data result
|
|
||||||
--
|
|
||||||
local function insertSync(query, parameters)
|
|
||||||
local p = promise.new()
|
|
||||||
exports['oxmysql']:insert(query, parameters, function(result)
|
|
||||||
p:resolve(result)
|
|
||||||
end)
|
|
||||||
return Citizen.Await(p)
|
|
||||||
end
|
|
||||||
exports('insertSync', insertSync)
|
|
||||||
@@ -1,115 +0,0 @@
|
|||||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
||||||
# yarn lockfile v1
|
|
||||||
|
|
||||||
|
|
||||||
"@citizenfx/server@^2.0.4376-1":
|
|
||||||
version "2.0.4376-1"
|
|
||||||
resolved "https://registry.yarnpkg.com/@citizenfx/server/-/server-2.0.4376-1.tgz#6cc9e034bc463a031df40532f278b9f309b7f258"
|
|
||||||
integrity sha512-xIqpuSwbyga3ysSJ3NfiDeJ6+L3cEHI+vRF45IjMP3U0E4bMZLGrjoSXBbndDJjd97uPdak3HPZD4/AC0HBnIw==
|
|
||||||
|
|
||||||
connection-string-parser@^1.0.4:
|
|
||||||
version "1.0.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/connection-string-parser/-/connection-string-parser-1.0.4.tgz#27f1379694fccd7c1c0066db3de0960f9d0dd619"
|
|
||||||
integrity sha512-grmrIHzrZRjn53dwRqJTmtTRVc+gUiIk/tzjUrteN6aLN4l9DR6KE/IsGtjndyAlHhkmKjAHB9p7PJ0cFgO94w==
|
|
||||||
dependencies:
|
|
||||||
tslib "^2.0.0"
|
|
||||||
|
|
||||||
denque@^1.4.1:
|
|
||||||
version "1.5.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/denque/-/denque-1.5.0.tgz#773de0686ff2d8ec2ff92914316a47b73b1c73de"
|
|
||||||
integrity sha512-CYiCSgIF1p6EUByQPlGkKnP1M9g0ZV3qMIrqMqZqdwazygIA/YP2vrbcyl1h/WppKJTdl1F85cXIle+394iDAQ==
|
|
||||||
|
|
||||||
generate-function@^2.3.1:
|
|
||||||
version "2.3.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/generate-function/-/generate-function-2.3.1.tgz#f069617690c10c868e73b8465746764f97c3479f"
|
|
||||||
integrity sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==
|
|
||||||
dependencies:
|
|
||||||
is-property "^1.0.2"
|
|
||||||
|
|
||||||
iconv-lite@^0.6.2:
|
|
||||||
version "0.6.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501"
|
|
||||||
integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==
|
|
||||||
dependencies:
|
|
||||||
safer-buffer ">= 2.1.2 < 3.0.0"
|
|
||||||
|
|
||||||
is-property@^1.0.2:
|
|
||||||
version "1.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84"
|
|
||||||
integrity sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=
|
|
||||||
|
|
||||||
long@^4.0.0:
|
|
||||||
version "4.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28"
|
|
||||||
integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==
|
|
||||||
|
|
||||||
lru-cache@^4.1.3:
|
|
||||||
version "4.1.5"
|
|
||||||
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd"
|
|
||||||
integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==
|
|
||||||
dependencies:
|
|
||||||
pseudomap "^1.0.2"
|
|
||||||
yallist "^2.1.2"
|
|
||||||
|
|
||||||
lru-cache@^6.0.0:
|
|
||||||
version "6.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
|
|
||||||
integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==
|
|
||||||
dependencies:
|
|
||||||
yallist "^4.0.0"
|
|
||||||
|
|
||||||
mysql2@^2.3.0:
|
|
||||||
version "2.3.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/mysql2/-/mysql2-2.3.0.tgz#600f5cc27e397dfb77b59eac93666434f88e8079"
|
|
||||||
integrity sha512-0t5Ivps5Tdy5YHk5NdKwQhe/4Qyn2pload+S+UooDBvsqngtzujG1BaTWBihQLfeKO3t3122/GtusBtmHEHqww==
|
|
||||||
dependencies:
|
|
||||||
denque "^1.4.1"
|
|
||||||
generate-function "^2.3.1"
|
|
||||||
iconv-lite "^0.6.2"
|
|
||||||
long "^4.0.0"
|
|
||||||
lru-cache "^6.0.0"
|
|
||||||
named-placeholders "^1.1.2"
|
|
||||||
seq-queue "^0.0.5"
|
|
||||||
sqlstring "^2.3.2"
|
|
||||||
|
|
||||||
named-placeholders@^1.1.2:
|
|
||||||
version "1.1.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/named-placeholders/-/named-placeholders-1.1.2.tgz#ceb1fbff50b6b33492b5cf214ccf5e39cef3d0e8"
|
|
||||||
integrity sha512-wiFWqxoLL3PGVReSZpjLVxyJ1bRqe+KKJVbr4hGs1KWfTZTQyezHFBbuKj9hsizHyGV2ne7EMjHdxEGAybD5SA==
|
|
||||||
dependencies:
|
|
||||||
lru-cache "^4.1.3"
|
|
||||||
|
|
||||||
pseudomap@^1.0.2:
|
|
||||||
version "1.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"
|
|
||||||
integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM=
|
|
||||||
|
|
||||||
"safer-buffer@>= 2.1.2 < 3.0.0":
|
|
||||||
version "2.1.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
|
|
||||||
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
|
|
||||||
|
|
||||||
seq-queue@^0.0.5:
|
|
||||||
version "0.0.5"
|
|
||||||
resolved "https://registry.yarnpkg.com/seq-queue/-/seq-queue-0.0.5.tgz#d56812e1c017a6e4e7c3e3a37a1da6d78dd3c93e"
|
|
||||||
integrity sha1-1WgS4cAXpuTnw+Ojeh2m143TyT4=
|
|
||||||
|
|
||||||
sqlstring@^2.3.2:
|
|
||||||
version "2.3.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/sqlstring/-/sqlstring-2.3.2.tgz#cdae7169389a1375b18e885f2e60b3e460809514"
|
|
||||||
integrity sha512-vF4ZbYdKS8OnoJAWBmMxCQDkiEBkGQYU7UZPtL8flbDRSNkhaXvRJ279ZtI6M+zDaQovVU4tuRgzK5fVhvFAhg==
|
|
||||||
|
|
||||||
tslib@^2.0.0:
|
|
||||||
version "2.3.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
|
|
||||||
integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==
|
|
||||||
|
|
||||||
yallist@^2.1.2:
|
|
||||||
version "2.1.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"
|
|
||||||
integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=
|
|
||||||
|
|
||||||
yallist@^4.0.0:
|
|
||||||
version "4.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
|
|
||||||
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
|
|
||||||
Reference in new issue
Block a user