Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gajus/slonik
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v33.0.4
Choose a base ref
...
head repository: gajus/slonik
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v33.0.5
Choose a head ref
  • 2 commits
  • 7 files changed
  • 1 contributor

Commits on Dec 16, 2022

  1. Copy the full SHA
    1cd87c2 View commit details
  2. fix: update token

    gajus committed Dec 16, 2022
    Copy the full SHA
    d3d4eda View commit details
15 changes: 14 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@
"dependencies": {
"concat-stream": "^2.0.0",
"es6-error": "^4.1.1",
"fast-safe-stringify": "^2.1.1",
"get-stack-trace": "^2.1.1",
"hyperid": "^2.3.1",
"is-plain-object": "^5.0.0",
@@ -22,6 +21,7 @@
"postgres-array": "^3.0.1",
"postgres-interval": "^4.0.0",
"roarr": "^7.14.0",
"safe-stable-stringify": "^2.4.1",
"serialize-error": "^8.0.0",
"through2": "^4.0.2",
"zod": "^3.19.1"
4 changes: 3 additions & 1 deletion src/factories/createPrimitiveValueExpressions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import safeStringify from 'fast-safe-stringify';
import {
Logger,
} from '../Logger';
@@ -8,6 +7,9 @@ import {
import {
type PrimitiveValueExpression,
} from '../types';
import {
safeStringify,
} from '../utilities';

const log = Logger.child({
namespace: 'createPrimitiveValueExpressions',
2 changes: 1 addition & 1 deletion src/factories/createSqlTag.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import safeStringify from 'fast-safe-stringify';
import {
z,
type ZodTypeAny,
@@ -43,6 +42,7 @@ import {
type ValueExpression,
} from '../types';
import {
safeStringify,
escapeLiteralValue,
isPrimitiveValueExpression,
isSqlToken,
4 changes: 3 additions & 1 deletion src/sqlFragmentFactories/createJsonSqlFragment.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import safeStringify from 'fast-safe-stringify';
import {
isPlainObject,
} from 'is-plain-object';
@@ -16,6 +15,9 @@ import {
type JsonSqlToken,
type SqlFragment,
} from '../types';
import {
safeStringify,
} from '../utilities';

const log = Logger.child({
namespace: 'createJsonSqlFragment',
3 changes: 3 additions & 0 deletions src/utilities/index.ts
Original file line number Diff line number Diff line change
@@ -28,6 +28,9 @@ export {
export {
parseDsn,
} from './parseDsn';
export {
safeStringify,
} from './safeStringify';
export {
stringifyDsn,
} from './stringifyDsn';
19 changes: 19 additions & 0 deletions src/utilities/safeStringify.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import stringify from 'safe-stable-stringify';

export const safeStringify = (
subject: unknown,
replacer?:
| Array<number | string>
| ((key: string, value: unknown) => unknown)
| null
| undefined,
space?: number | string,
): string => {
const result = stringify(subject, replacer, space);

if (result === undefined) {
throw new Error('Expected result to be string');
}

return result;
};