sql.js 1.7.0 → 1.9.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.
@@ -6,7 +6,7 @@
6
6
 
7
7
  # See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.155.1/containers/typescript-node/.devcontainer/base.Dockerfile
8
8
  # [Choice] Node.js version: 14, 12, 10
9
- ARG VARIANT="14-buster"
9
+ ARG VARIANT="16-buster"
10
10
  FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT}
11
11
 
12
12
  # [Optional] Uncomment if you want to install an additional version of node using nvm
@@ -24,7 +24,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT}
24
24
  # Install EMSDK to /emsdk just like the EMSDK Dockerfile: https://github.com/emscripten-core/emsdk/blob/master/docker/Dockerfile
25
25
  ENV EMSDK /emsdk
26
26
  # We pin the EMSDK version rather than 'latest' so that everyone is using the same compiler version
27
- ENV EMSCRIPTEN_VERSION 3.1.8
27
+ ENV EMSCRIPTEN_VERSION 3.1.49
28
28
 
29
29
  RUN git clone https://github.com/emscripten-core/emsdk.git $EMSDK
30
30
 
@@ -85,47 +85,15 @@ RUN echo 'export EM_NODE_JS="$EMSDK_NODE"' >> /etc/bash.bashrc
85
85
  # List taken from:
86
86
  # https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#chrome-headless-doesnt-launch-on-unix
87
87
  RUN apt-get update \
88
- && apt-get install -y \
89
- ca-certificates \
90
- fonts-liberation \
91
- libappindicator3-1 \
92
- libasound2 \
93
- libatk-bridge2.0-0 \
94
- libatk1.0-0 \
95
- libc6 \
96
- libcairo2 \
97
- libcups2 \
98
- libdbus-1-3 \
99
- libexpat1 \
100
- libfontconfig1 \
101
- libgbm1 \
102
- libgcc1 \
103
- libglib2.0-0 \
104
- libgtk-3-0 \
105
- libnspr4 \
106
- libnss3 \
107
- libpango-1.0-0 \
108
- libpangocairo-1.0-0 \
109
- libstdc++6 \
110
- libx11-6 \
111
- libx11-xcb1 \
112
- libxcb1 \
113
- libxcomposite1 \
114
- libxcursor1 \
115
- libxdamage1 \
116
- libxext6 \
117
- libxfixes3 \
118
- libxi6 \
119
- libxrandr2 \
120
- libxrender1 \
121
- libxss1 \
122
- libxtst6 \
123
- lsb-release \
124
- wget \
125
- xdg-utils
126
-
127
- # Installs the command "sha3sum", which is used check the download integrity of sqlite source.
128
- RUN apt-get install -y libdigest-sha3-perl
88
+ && apt-get install -y wget gnupg \
89
+ && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
90
+ && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
91
+ && apt-get update \
92
+ && apt-get install -y google-chrome-stable fonts-freefont-ttf libxss1 libxshmfence1 libglu1 \
93
+ --no-install-recommends \
94
+ # Installs the command "sha3sum", which is used check the download integrity of sqlite source.
95
+ && apt-get install -y libdigest-sha3-perl \
96
+ && rm -rf /var/lib/apt/lists/*
129
97
 
130
98
  # We set this env variable (RUN_WORKER_TEST_WITHOUT_PUPPETEER_SANDBOX=1) this to tell our sql.js test harness to run Puppeteer without the sandbox.
131
99
  # Otherwise, when we instantiate Puppeteer, we get this error:
@@ -4,9 +4,9 @@
4
4
  "name": "Node.js & TypeScript",
5
5
  "build": {
6
6
  "dockerfile": "Dockerfile",
7
- // Update 'VARIANT' to pick a Node version: 10, 12, 14
7
+ // Update 'VARIANT' to pick a Node version: 12, 14, 16
8
8
  "args": {
9
- "VARIANT": "14-buster"
9
+ "VARIANT": "16-buster"
10
10
  },
11
11
  },
12
12
  // Set *default* container specific settings.json values on container create.
package/.eslintrc.js CHANGED
@@ -16,6 +16,7 @@ module.exports = {
16
16
  ignorePatterns: [
17
17
  "/dist/",
18
18
  "/examples/",
19
+ "/documentation/",
19
20
  "/node_modules/",
20
21
  "/out/",
21
22
  "/src/shell-post.js",
package/CONTRIBUTING.md CHANGED
@@ -52,7 +52,7 @@ Instructions:
52
52
 
53
53
  ## Compiling SQLite with different options
54
54
 
55
- In order to enable extensions like JSON1 or FTS5, change the CFLAGS in the [Makefile](Makefile) and run `npm run rebuild`:
55
+ In order to enable extensions like FTS5, change the CFLAGS in the [Makefile](Makefile) and run `npm run rebuild`:
56
56
 
57
57
  ``` diff
58
58
  CFLAGS = \
@@ -62,6 +62,5 @@ CFLAGS = \
62
62
  -DSQLITE_ENABLE_FTS3 \
63
63
  -DSQLITE_ENABLE_FTS3_PARENTHESIS \
64
64
  + -DSQLITE_ENABLE_FTS5 \
65
- + -DSQLITE_ENABLE_JSON1 \
66
65
  -DSQLITE_THREADSAFE=0
67
66
  ```
package/README.md CHANGED
@@ -75,6 +75,33 @@ db.create_function("add_js", add);
75
75
  // Run a query in which the function is used
76
76
  db.run("INSERT INTO hello VALUES (add_js(7, 3), add_js('Hello ', 'world'));"); // Inserts 10 and 'Hello world'
77
77
 
78
+ // You can create custom aggregation functions, by passing a name
79
+ // and a set of functions to `db.create_aggregate`:
80
+ //
81
+ // - an `init` function. This function receives no argument and returns
82
+ // the initial value for the state of the aggregate function.
83
+ // - a `step` function. This function takes two arguments
84
+ // - the current state of the aggregation
85
+ // - a new value to aggregate to the state
86
+ // It should return a new value for the state.
87
+ // - a `finalize` function. This function receives a state object, and
88
+ // returns the final value of the aggregate. It can be omitted, in which case
89
+ // the final value of the state will be returned directly by the aggregate function.
90
+ //
91
+ // Here is an example aggregation function, `json_agg`, which will collect all
92
+ // input values and return them as a JSON array:
93
+ db.create_aggregate(
94
+ "json_agg",
95
+ {
96
+ init: () => [],
97
+ step: (state, val) => [...state, val],
98
+ finalize: (state) => JSON.stringify(state),
99
+ }
100
+ );
101
+
102
+ db.exec("SELECT json_agg(column1) FROM (VALUES ('hello'), ('world'))");
103
+ // -> The result of the query is the string '["hello","world"]'
104
+
78
105
  // Export the database to an Uint8Array containing the SQLite database file
79
106
  const binaryArray = db.export();
80
107
  ```
@@ -243,7 +270,7 @@ If you need ```BigInt``` support, it is partially supported since most browsers
243
270
  while (stmt.step()) console.log(stmt.get(null, config));
244
271
 
245
272
  /*OR*/
246
- const result = db.exec("SELECT * FROM test", config);
273
+ const results = db.exec("SELECT * FROM test", config);
247
274
  console.log(results[0].values)
248
275
  </script>
249
276
  ```