Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@balena/sbvr-types

Package Overview
Dependencies
Maintainers
3
Versions
222
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@balena/sbvr-types - npm Package Compare versions

Comparing version 8.0.0-build-joshbwlng-big-int-952f52b6b152822c3ba745d8caac32c12865fad4-1 to 8.0.0-build-joshbwlng-big-int-b9b1fc31b91220e66dcb23f43b92036d6e758045-1

18

CHANGELOG.md

@@ -8,7 +8,21 @@ # Change Log

# v8.0.0
## (2024-06-04)
## (2024-06-12)
* Fixes [Josh Bowling]
* Improve BigInteger and BigSerial support [Josh Bowling]
# v7.1.3
## (2024-06-12)
* Add typings for all abstract sql fragments, fixing where necessary [Pagan Gazzard]
# v7.1.2
## (2024-06-12)
* Explicitly type the `compare` function for `hashed` [Pagan Gazzard]
# v7.1.1
## (2024-06-04)
* Accept `Date` for the write types of `Date Time`/`Date`/`Time` [Pagan Gazzard]
# v7.1.0

@@ -15,0 +29,0 @@ ## (2024-04-25)

12

out/type-utils.d.ts

@@ -0,1 +1,5 @@

import type { AnyTypeNodes, EqualsNode, LessThanNode, LessThanOrEqualNode, ReferencedFieldNode } from '@balena/abstract-sql-compiler';
export type NativeNames = Record<string, AnyTypeNodes>;
export type NativeProperties = Record<string, Record<string, (from: ReferencedFieldNode) => AnyTypeNodes>>;
export type NativeFactTypes = Record<string, Record<string, (from: ReferencedFieldNode, to: ReferencedFieldNode) => AnyTypeNodes>>;
export interface DatabaseTypeFn {

@@ -31,8 +35,8 @@ (necessity: string, index: string): string;

equality: {
'is equal to': (from: string, to: string) => string[];
'is equal to': (from: ReferencedFieldNode, to: ReferencedFieldNode) => EqualsNode;
};
comparison: {
'is equal to': (from: string, to: string) => string[];
'is less than': (from: string, to: string) => string[];
'is less than or equal to': (from: string, to: string) => string[];
'is equal to': (from: ReferencedFieldNode, to: ReferencedFieldNode) => EqualsNode;
'is less than': (from: ReferencedFieldNode, to: ReferencedFieldNode) => LessThanNode;
'is less than or equal to': (from: ReferencedFieldNode, to: ReferencedFieldNode) => LessThanOrEqualNode;
};

@@ -39,0 +43,0 @@ };

@@ -13,15 +13,4 @@ import * as TypeUtils from '../type-utils';

export declare const fetchProcessing: TypeUtils.FetchProcessing<Types['Read']>;
export declare const nativeFactTypes: {
Integer: {
'is equal to': (from: string, to: string) => string[];
'is less than': (from: string, to: string) => string[];
'is less than or equal to': (from: string, to: string) => string[];
};
Real: {
'is equal to': (from: string, to: string) => string[];
'is less than': (from: string, to: string) => string[];
'is less than or equal to': (from: string, to: string) => string[];
};
};
export declare const nativeFactTypes: TypeUtils.NativeFactTypes;
export declare const validate: TypeUtils.Validate<Types['Write'], DbWriteType>;
export {};

@@ -19,12 +19,5 @@ import * as TypeUtils from '../type-utils';

type DbWriteType = number;
export declare const nativeProperties: {
has: {
'Red Component': (from: string) => (string | number | (string | number)[])[];
'Green Component': (from: string) => (string | number | (string | number)[])[];
'Blue Component': (from: string) => (string | number)[];
'Alpha Component': (from: string) => (string | number | (string | number)[])[];
};
};
export declare const nativeProperties: TypeUtils.NativeProperties;
export declare const fetchProcessing: TypeUtils.FetchProcessing<Types['Read']>;
export declare const validate: TypeUtils.Validate<Types['Write'], DbWriteType>;
export {};

@@ -24,15 +24,19 @@ "use strict";

'BitwiseAnd',
['BitwiseShiftRight', from, 16],
255,
['BitwiseShiftRight', from, ['Number', 16]],
['Number', 255],
],
'Green Component': (from) => [
'BitwiseAnd',
['BitwiseShiftRight', from, 8],
255,
['BitwiseShiftRight', from, ['Number', 8]],
['Number', 255],
],
'Blue Component': (from) => ['BitwiseShiftRight', from, 255],
'Blue Component': (from) => [
'BitwiseShiftRight',
from,
['Number', 255],
],
'Alpha Component': (from) => [
'BitwiseAnd',
['BitwiseShiftRight', from, 24],
255,
['BitwiseShiftRight', from, ['Number', 24]],
['Number', 255],
],

@@ -39,0 +43,0 @@ },

@@ -12,15 +12,4 @@ import * as TypeUtils from '../type-utils';

type DbWriteType = number;
export declare const nativeFactTypes: {
Integer: {
'is equal to': (from: string, to: string) => string[];
'is less than': (from: string, to: string) => string[];
'is less than or equal to': (from: string, to: string) => string[];
};
Real: {
'is equal to': (from: string, to: string) => string[];
'is less than': (from: string, to: string) => string[];
'is less than or equal to': (from: string, to: string) => string[];
};
};
export declare const nativeFactTypes: TypeUtils.NativeFactTypes;
export declare const validate: TypeUtils.Validate<Types['Write'], DbWriteType>;
export {};

@@ -10,15 +10,8 @@ import * as TypeUtils from '../type-utils';

};
export type Types = TypeUtils.TsTypes<string, string | number>;
export type Types = TypeUtils.TsTypes<string, string | number | Date>;
type DbWriteType = Date;
export declare const fetchProcessing: TypeUtils.FetchProcessing<Types['Read']>;
export declare const nativeFactTypes: {
'Date Time': {
'is before': (from: string, to: string) => string[];
'is equal to': (from: string, to: string) => string[];
};
};
export declare const nativeNames: {
'Current Time': string[];
};
export declare const nativeFactTypes: TypeUtils.NativeFactTypes;
export declare const nativeNames: TypeUtils.NativeNames;
export declare const validate: TypeUtils.Validate<Types['Write'], DbWriteType>;
export {};

@@ -37,5 +37,5 @@ "use strict";

exports.nativeNames = {
'Current Time': ['Now'],
'Current Time': ['CurrentTimestamp'],
};
exports.validate = TypeUtils.validate.date;
//# sourceMappingURL=date-time.js.map

@@ -10,12 +10,7 @@ import * as TypeUtils from '../type-utils';

};
export type Types = TypeUtils.TsTypes<string, string | number>;
export type Types = TypeUtils.TsTypes<string, string | number | Date>;
type DbWriteType = Date;
export declare const fetchProcessing: TypeUtils.FetchProcessing<Types['Read']>;
export declare const nativeFactTypes: {
Date: {
'is before': (from: string, to: string) => string[];
'is equal to': (from: string, to: string) => string[];
};
};
export declare const nativeFactTypes: TypeUtils.NativeFactTypes;
export declare const validate: TypeUtils.Validate<Types['Write'], DbWriteType>;
export {};

@@ -12,15 +12,4 @@ import * as TypeUtils from '../type-utils';

type DbWriteType = number;
export declare const nativeFactTypes: {
Integer: {
'is equal to': (from: string, to: string) => string[];
'is less than': (from: string, to: string) => string[];
'is less than or equal to': (from: string, to: string) => string[];
};
Real: {
'is equal to': (from: string, to: string) => string[];
'is less than': (from: string, to: string) => string[];
'is less than or equal to': (from: string, to: string) => string[];
};
};
export declare const nativeFactTypes: TypeUtils.NativeFactTypes;
export declare const validate: TypeUtils.Validate<Types['Write'], DbWriteType>;
export {};

@@ -1,2 +0,2 @@

import type * as Bcrypt from 'bcrypt';
/// <reference types="node" />
import * as TypeUtils from '../type-utils';

@@ -14,3 +14,3 @@ export declare const types: {

export declare const validate: TypeUtils.Validate<Types['Write'], DbWriteType>;
export declare const compare: typeof Bcrypt.compare;
export declare const compare: (data: string | Buffer, encrypted: string) => Promise<boolean>;
export {};

@@ -12,15 +12,4 @@ import * as TypeUtils from '../type-utils';

type DbWriteType = number;
export declare const nativeFactTypes: {
Integer: {
'is equal to': (from: string, to: string) => string[];
'is less than': (from: string, to: string) => string[];
'is less than or equal to': (from: string, to: string) => string[];
};
Real: {
'is equal to': (from: string, to: string) => string[];
'is less than': (from: string, to: string) => string[];
'is less than or equal to': (from: string, to: string) => string[];
};
};
export declare const nativeFactTypes: TypeUtils.NativeFactTypes;
export declare const validate: TypeUtils.Validate<Types['Write'], DbWriteType>;
export {};

@@ -12,15 +12,4 @@ import * as TypeUtils from '../type-utils';

type DbWriteType = number;
export declare const nativeFactTypes: {
Integer: {
'is equal to': (from: string, to: string) => string[];
'is less than': (from: string, to: string) => string[];
'is less than or equal to': (from: string, to: string) => string[];
};
Real: {
'is equal to': (from: string, to: string) => string[];
'is less than': (from: string, to: string) => string[];
'is less than or equal to': (from: string, to: string) => string[];
};
};
export declare const nativeFactTypes: TypeUtils.NativeFactTypes;
export declare const validate: TypeUtils.Validate<Types['Write'], DbWriteType>;
export {};

@@ -12,16 +12,5 @@ import * as TypeUtils from '../type-utils';

type DbWriteType = string;
export declare const nativeProperties: {
has: {
Length: (from: string) => string[];
};
};
export declare const nativeFactTypes: {
Text: {
'starts with': (from: string, to: string) => string[];
'ends with': (from: string, to: string) => string[];
contains: (from: string, to: string) => string[];
'is equal to': (from: string, to: string) => string[];
};
};
export declare const nativeProperties: TypeUtils.NativeProperties;
export declare const nativeFactTypes: TypeUtils.NativeFactTypes;
export declare const validate: TypeUtils.Validate<Types['Write'], DbWriteType>;
export {};

@@ -21,4 +21,4 @@ "use strict";

...TypeUtils.nativeFactTypeTemplates.equality,
'starts with': (from, to) => ['Startswith', from, to],
'ends with': (from, to) => ['Endswith', from, to],
'starts with': (from, to) => ['StartsWith', from, to],
'ends with': (from, to) => ['EndsWith', from, to],
contains: (from, to) => ['Contains', from, to],

@@ -25,0 +25,0 @@ },

@@ -10,3 +10,3 @@ import * as TypeUtils from '../type-utils';

};
export type Types = TypeUtils.TsTypes<string, number | string>;
export type Types = TypeUtils.TsTypes<string, number | string | Date>;
type DbWriteType = string;

@@ -13,0 +13,0 @@ export declare const fetchProcessing: TypeUtils.FetchProcessing<Types['Read']>;

import * as TypeUtils from '../type-utils';
import type { CastNode, ExtractJSONPathAsTextNode, ReferencedFieldNode } from '@balena/abstract-sql-compiler';
export type WebResource = {

@@ -22,14 +21,5 @@ filename: string;

type DbWriteType = string;
export declare const nativeProperties: {
has: {
Filename: (referencedField: ReferencedFieldNode) => ExtractJSONPathAsTextNode;
HRef: (referencedField: ReferencedFieldNode) => ExtractJSONPathAsTextNode;
'Content Type': (referencedField: ReferencedFieldNode) => ExtractJSONPathAsTextNode;
'Content Disposition': (referencedField: ReferencedFieldNode) => ExtractJSONPathAsTextNode;
Checksum: (referencedField: ReferencedFieldNode) => ExtractJSONPathAsTextNode;
Size: (referencedField: ReferencedFieldNode) => CastNode;
};
};
export declare const nativeProperties: TypeUtils.NativeProperties;
export declare const fetchProcessing: TypeUtils.FetchProcessing<Types['Read']>;
export declare const validate: TypeUtils.Validate<Types['Write'], DbWriteType>;
export {};
{
"name": "@balena/sbvr-types",
"version": "8.0.0-build-joshbwlng-big-int-952f52b6b152822c3ba745d8caac32c12865fad4-1",
"version": "8.0.0-build-joshbwlng-big-int-b9b1fc31b91220e66dcb23f43b92036d6e758045-1",
"description": "SBVR type definitions.",

@@ -23,6 +23,6 @@ "main": "out",

"devDependencies": {
"@balena/abstract-sql-compiler": "^9.0.5",
"@balena/lint": "^8.0.0",
"@balena/abstract-sql-compiler": "^9.2.0",
"@balena/lint": "^8.0.2",
"@types/bcrypt": "^5.0.2",
"@types/chai": "^4.3.12",
"@types/chai": "^4.3.16",
"@types/chai-datetime": "^0.0.39",

@@ -33,7 +33,7 @@ "@types/mocha": "^10.0.6",

"chai-datetime": "^1.8.0",
"husky": "^9.0.0",
"lint-staged": "^15.2.2",
"mocha": "^10.3.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.6",
"mocha": "^10.4.0",
"ts-node": "^10.9.2",
"typescript": "^5.4.2"
"typescript": "^5.4.5"
},

@@ -56,4 +56,4 @@ "lint-staged": {

"versionist": {
"publishedAt": "2024-06-04T01:36:45.076Z"
"publishedAt": "2024-06-12T22:03:08.706Z"
}
}

@@ -0,1 +1,22 @@

import type {
AnyTypeNodes,
EqualsNode,
LessThanNode,
LessThanOrEqualNode,
ReferencedFieldNode,
} from '@balena/abstract-sql-compiler';
export type NativeNames = Record<string, AnyTypeNodes>;
export type NativeProperties = Record<
string,
Record<string, (from: ReferencedFieldNode) => AnyTypeNodes>
>;
export type NativeFactTypes = Record<
string,
Record<
string,
(from: ReferencedFieldNode, to: ReferencedFieldNode) => AnyTypeNodes
>
>;
export interface DatabaseTypeFn {

@@ -51,9 +72,9 @@ (necessity: string, index: string): string;

const equality = {
'is equal to': (from: string, to: string) => ['Equals', from, to],
};
'is equal to': (from, to): EqualsNode => ['Equals', from, to],
} satisfies NativeFactTypes[string];
export const nativeFactTypeTemplates = {
equality,
comparison: {
'is less than': (from: string, to: string) => ['LessThan', from, to],
'is less than or equal to': (from: string, to: string) => [
'is less than': (from, to): LessThanNode => ['LessThan', from, to],
'is less than or equal to': (from, to): LessThanOrEqualNode => [
'LessThanOrEqual',

@@ -65,3 +86,3 @@ from,

},
};
} satisfies Record<string, NativeFactTypes[string]>;

@@ -68,0 +89,0 @@ export const validate = {

@@ -32,3 +32,3 @@ import * as TypeUtils from '../type-utils';

export const nativeFactTypes = {
export const nativeFactTypes: TypeUtils.NativeFactTypes = {
Integer: TypeUtils.nativeFactTypeTemplates.comparison,

@@ -35,0 +35,0 @@ Real: TypeUtils.nativeFactTypeTemplates.comparison,

@@ -0,1 +1,5 @@

import type {
BitwiseAndNode,
BitwiseShiftRightNode,
} from '@balena/abstract-sql-compiler';
import * as TypeUtils from '../type-utils';

@@ -28,19 +32,23 @@

export const nativeProperties = {
export const nativeProperties: TypeUtils.NativeProperties = {
has: {
'Red Component': (from: string) => [
'Red Component': (from): BitwiseAndNode => [
'BitwiseAnd',
['BitwiseShiftRight', from, 16],
255,
['BitwiseShiftRight', from, ['Number', 16]],
['Number', 255],
],
'Green Component': (from: string) => [
'Green Component': (from): BitwiseAndNode => [
'BitwiseAnd',
['BitwiseShiftRight', from, 8],
255,
['BitwiseShiftRight', from, ['Number', 8]],
['Number', 255],
],
'Blue Component': (from: string) => ['BitwiseShiftRight', from, 255],
'Alpha Component': (from: string) => [
'Blue Component': (from): BitwiseShiftRightNode => [
'BitwiseShiftRight',
from,
['Number', 255],
],
'Alpha Component': (from): BitwiseAndNode => [
'BitwiseAnd',
['BitwiseShiftRight', from, 24],
255,
['BitwiseShiftRight', from, ['Number', 24]],
['Number', 255],
],

@@ -47,0 +55,0 @@ },

@@ -15,3 +15,3 @@ import * as TypeUtils from '../type-utils';

export const nativeFactTypes = {
export const nativeFactTypes: TypeUtils.NativeFactTypes = {
Integer: TypeUtils.nativeFactTypeTemplates.comparison,

@@ -18,0 +18,0 @@ Real: TypeUtils.nativeFactTypeTemplates.comparison,

@@ -0,1 +1,5 @@

import type {
CurrentTimestampNode,
LessThanNode,
} from '@balena/abstract-sql-compiler';
import * as TypeUtils from '../type-utils';

@@ -12,3 +16,3 @@

export type Types = TypeUtils.TsTypes<string, string | number>;
export type Types = TypeUtils.TsTypes<string, string | number | Date>;
type DbWriteType = Date;

@@ -33,11 +37,11 @@

export const nativeFactTypes = {
export const nativeFactTypes: TypeUtils.NativeFactTypes = {
'Date Time': {
...TypeUtils.nativeFactTypeTemplates.equality,
'is before': (from: string, to: string) => ['LessThan', from, to],
'is before': (from, to): LessThanNode => ['LessThan', from, to],
},
};
export const nativeNames = {
'Current Time': ['Now'],
export const nativeNames: TypeUtils.NativeNames = {
'Current Time': ['CurrentTimestamp'] satisfies CurrentTimestampNode,
};

@@ -44,0 +48,0 @@

@@ -0,1 +1,2 @@

import type { LessThanNode } from '@balena/abstract-sql-compiler';
import * as TypeUtils from '../type-utils';

@@ -12,3 +13,3 @@

export type Types = TypeUtils.TsTypes<string, string | number>;
export type Types = TypeUtils.TsTypes<string, string | number | Date>;
type DbWriteType = Date;

@@ -33,6 +34,6 @@

export const nativeFactTypes = {
export const nativeFactTypes: TypeUtils.NativeFactTypes = {
Date: {
...TypeUtils.nativeFactTypeTemplates.equality,
'is before': (from: string, to: string) => ['LessThan', from, to],
'is before': (from, to): LessThanNode => ['LessThan', from, to],
},

@@ -39,0 +40,0 @@ };

@@ -15,3 +15,3 @@ import * as TypeUtils from '../type-utils';

export const nativeFactTypes = {
export const nativeFactTypes: TypeUtils.NativeFactTypes = {
Integer: TypeUtils.nativeFactTypeTemplates.comparison,

@@ -18,0 +18,0 @@ Real: TypeUtils.nativeFactTypeTemplates.comparison,

@@ -33,2 +33,5 @@ import type * as Bcrypt from 'bcrypt';

export const compare = bcrypt.compare.bind(bcrypt);
export const compare: (
data: string | Buffer,
encrypted: string,
) => Promise<boolean> = bcrypt.compare.bind(bcrypt);

@@ -15,3 +15,3 @@ import * as TypeUtils from '../type-utils';

export const nativeFactTypes = {
export const nativeFactTypes: TypeUtils.NativeFactTypes = {
Integer: TypeUtils.nativeFactTypeTemplates.comparison,

@@ -18,0 +18,0 @@ Real: TypeUtils.nativeFactTypeTemplates.comparison,

@@ -15,3 +15,3 @@ import * as TypeUtils from '../type-utils';

export const nativeFactTypes = {
export const nativeFactTypes: TypeUtils.NativeFactTypes = {
Integer: TypeUtils.nativeFactTypeTemplates.comparison,

@@ -18,0 +18,0 @@ Real: TypeUtils.nativeFactTypeTemplates.comparison,

@@ -0,1 +1,7 @@

import type {
CharacterLengthNode,
StartsWithNode,
EndsWithNode,
ContainsNode,
} from '@balena/abstract-sql-compiler';
import * as TypeUtils from '../type-utils';

@@ -15,14 +21,14 @@

export const nativeProperties = {
export const nativeProperties: TypeUtils.NativeProperties = {
has: {
Length: (from: string) => ['CharacterLength', from],
Length: (from): CharacterLengthNode => ['CharacterLength', from],
},
};
export const nativeFactTypes = {
export const nativeFactTypes: TypeUtils.NativeFactTypes = {
Text: {
...TypeUtils.nativeFactTypeTemplates.equality,
'starts with': (from: string, to: string) => ['Startswith', from, to],
'ends with': (from: string, to: string) => ['Endswith', from, to],
contains: (from: string, to: string) => ['Contains', from, to],
'starts with': (from, to): StartsWithNode => ['StartsWith', from, to],
'ends with': (from, to): EndsWithNode => ['EndsWith', from, to],
contains: (from, to): ContainsNode => ['Contains', from, to],
},

@@ -29,0 +35,0 @@ };

@@ -12,3 +12,3 @@ import * as TypeUtils from '../type-utils';

export type Types = TypeUtils.TsTypes<string, number | string>;
export type Types = TypeUtils.TsTypes<string, number | string | Date>;
type DbWriteType = string;

@@ -15,0 +15,0 @@

@@ -5,3 +5,2 @@ import * as TypeUtils from '../type-utils';

ExtractJSONPathAsTextNode,
ReferencedFieldNode,
} from '@balena/abstract-sql-compiler';

@@ -39,7 +38,5 @@

export const nativeProperties = {
export const nativeProperties: TypeUtils.NativeProperties = {
has: {
Filename: (
referencedField: ReferencedFieldNode,
): ExtractJSONPathAsTextNode => [
Filename: (referencedField): ExtractJSONPathAsTextNode => [
'ExtractJSONPathAsText',

@@ -49,3 +46,3 @@ referencedField,

],
HRef: (referencedField: ReferencedFieldNode): ExtractJSONPathAsTextNode => [
HRef: (referencedField): ExtractJSONPathAsTextNode => [
'ExtractJSONPathAsText',

@@ -55,5 +52,3 @@ referencedField,

],
'Content Type': (
referencedField: ReferencedFieldNode,
): ExtractJSONPathAsTextNode => [
'Content Type': (referencedField): ExtractJSONPathAsTextNode => [
'ExtractJSONPathAsText',

@@ -63,5 +58,3 @@ referencedField,

],
'Content Disposition': (
referencedField: ReferencedFieldNode,
): ExtractJSONPathAsTextNode => [
'Content Disposition': (referencedField): ExtractJSONPathAsTextNode => [
'ExtractJSONPathAsText',

@@ -71,5 +64,3 @@ referencedField,

],
Checksum: (
referencedField: ReferencedFieldNode,
): ExtractJSONPathAsTextNode => [
Checksum: (referencedField): ExtractJSONPathAsTextNode => [
'ExtractJSONPathAsText',

@@ -79,3 +70,3 @@ referencedField,

],
Size: (referencedField: ReferencedFieldNode): CastNode => [
Size: (referencedField): CastNode => [
'Cast',

@@ -82,0 +73,0 @@ [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc