Socket
Socket
Sign inDemoInstall

flatbuffers

Package Overview
Dependencies
Maintainers
2
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flatbuffers - npm Package Compare versions

Comparing version 2.0.7 to 22.10.25

js/flatbuffers.d.ts

8

js/builder.d.ts
import { ByteBuffer } from "./byte-buffer.js";
import { Offset } from "./types.js";
import { Offset, IGeneratedObject } from "./types.js";
export declare class Builder {

@@ -209,3 +209,3 @@ private bb;

*/
createObjectOffset(obj: string | any): Offset;
createObjectOffset(obj: string | IGeneratedObject | null): Offset;
/**

@@ -216,4 +216,4 @@ * A helper function to pack a list of object

*/
createObjectOffsetList(list: string[] | any[]): Offset[];
createStructOffsetList(list: string[] | any[], startFunc: (builder: Builder, length: number) => void): Offset;
createObjectOffsetList(list: (string | IGeneratedObject)[]): Offset[];
createStructOffsetList(list: (string | IGeneratedObject)[], startFunc: (builder: Builder, length: number) => void): Offset;
}

@@ -0,0 +0,0 @@ "use strict";

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

import { Offset, Table } from "./types.js";
import { Offset, Table, IGeneratedObject, IUnpackableObject } from "./types.js";
import { Encoding } from "./encoding.js";

@@ -103,3 +103,3 @@ export declare class ByteBuffer {

*/
createScalarList(listAccessor: (i: number) => unknown, listLength: number): any[];
createScalarList<T>(listAccessor: (i: number) => T | null, listLength: number): T[];
/**

@@ -111,3 +111,3 @@ * A helper function for generating list for obj api

*/
createObjList(listAccessor: (i: number) => unknown, listLength: number): any[];
createObjList<T1 extends IUnpackableObject<T2>, T2 extends IGeneratedObject>(listAccessor: (i: number) => T1 | null, listLength: number): T2[];
}

@@ -227,4 +227,5 @@ "use strict";

for (var i = 0; i < listLength; ++i) {
if (listAccessor(i) !== null) {
ret.push(listAccessor(i));
var val = listAccessor(i);
if (val !== null) {
ret.push(val);
}

@@ -231,0 +232,0 @@ }

@@ -0,0 +0,0 @@ export declare const SIZEOF_SHORT = 2;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export declare enum Encoding {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Builder } from './flexbuffers/builder.js';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { BitWidth } from './bit-width.js';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export declare enum BitWidth {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { BitWidth } from './bit-width.js';

@@ -0,0 +0,0 @@ "use strict";

export declare function fromUTF8Array(data: BufferSource): string;
export declare function toUTF8Array(str: string): Uint8Array;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export declare function validateOffset(dataView: DataView, offset: number, width: number): void;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { ValueType } from './value-type.js';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Builder } from './builder.js';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { ValueType } from './value-type.js';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export declare enum ValueType {

@@ -0,0 +0,0 @@ "use strict";

@@ -5,3 +5,3 @@ export { SIZEOF_SHORT } from './constants.js';

export { SIZE_PREFIX_LENGTH } from './constants.js';
export { Table, Offset } from './types.js';
export { Table, Offset, IGeneratedObject, IUnpackableObject } from './types.js';
export { int32, float32, float64, isLittleEndian } from './utils.js';

@@ -8,0 +8,0 @@ export { Encoding } from './encoding.js';

@@ -0,0 +0,0 @@ "use strict";

@@ -10,3 +10,5 @@ import { ByteBuffer } from './byte-buffer.js';

pack(builder: Builder): Offset;
unpack(): IGeneratedObject;
}
export interface IUnpackableObject<T> {
unpack(): T;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -0,0 +0,0 @@ export declare const int32: Int32Array;

@@ -0,0 +0,0 @@ "use strict";

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

import { ByteBuffer } from "./byte-buffer.js";
import { Offset } from "./types.js";
import { Offset, IGeneratedObject } from "./types.js";
export declare class Builder {

@@ -209,3 +209,3 @@ private bb;

*/
createObjectOffset(obj: string | any): Offset;
createObjectOffset(obj: string | IGeneratedObject | null): Offset;
/**

@@ -216,4 +216,4 @@ * A helper function to pack a list of object

*/
createObjectOffsetList(list: string[] | any[]): Offset[];
createStructOffsetList(list: string[] | any[], startFunc: (builder: Builder, length: number) => void): Offset;
createObjectOffsetList(list: (string | IGeneratedObject)[]): Offset[];
createStructOffsetList(list: (string | IGeneratedObject)[], startFunc: (builder: Builder, length: number) => void): Offset;
}

@@ -0,0 +0,0 @@ import { ByteBuffer } from "./byte-buffer.js";

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

import { Offset, Table } from "./types.js";
import { Offset, Table, IGeneratedObject, IUnpackableObject } from "./types.js";
import { Encoding } from "./encoding.js";

@@ -103,3 +103,3 @@ export declare class ByteBuffer {

*/
createScalarList(listAccessor: (i: number) => unknown, listLength: number): any[];
createScalarList<T>(listAccessor: (i: number) => T | null, listLength: number): T[];
/**

@@ -111,3 +111,3 @@ * A helper function for generating list for obj api

*/
createObjList(listAccessor: (i: number) => unknown, listLength: number): any[];
createObjList<T1 extends IUnpackableObject<T2>, T2 extends IGeneratedObject>(listAccessor: (i: number) => T1 | null, listLength: number): T2[];
}

@@ -224,4 +224,5 @@ import { FILE_IDENTIFIER_LENGTH, SIZEOF_INT } from "./constants.js";

for (let i = 0; i < listLength; ++i) {
if (listAccessor(i) !== null) {
ret.push(listAccessor(i));
const val = listAccessor(i);
if (val !== null) {
ret.push(val);
}

@@ -228,0 +229,0 @@ }

@@ -0,0 +0,0 @@ export declare const SIZEOF_SHORT = 2;

@@ -0,0 +0,0 @@ export const SIZEOF_SHORT = 2;

@@ -0,0 +0,0 @@ export declare enum Encoding {

@@ -0,0 +0,0 @@ export var Encoding;

@@ -0,0 +0,0 @@ import { Builder } from './flexbuffers/builder.js';

@@ -0,0 +0,0 @@ /* eslint-disable @typescript-eslint/no-namespace */

@@ -0,0 +0,0 @@ import { BitWidth } from './bit-width.js';

@@ -0,0 +0,0 @@ import { BitWidth } from './bit-width.js';

@@ -0,0 +0,0 @@ export declare enum BitWidth {

@@ -0,0 +0,0 @@ export var BitWidth;

@@ -0,0 +0,0 @@ import { BitWidth } from './bit-width.js';

@@ -0,0 +0,0 @@ import { BitWidth } from './bit-width.js';

export declare function fromUTF8Array(data: BufferSource): string;
export declare function toUTF8Array(str: string): Uint8Array;

@@ -0,0 +0,0 @@ export function fromUTF8Array(data) {

@@ -0,0 +0,0 @@ export declare function validateOffset(dataView: DataView, offset: number, width: number): void;

@@ -0,0 +0,0 @@ import { BitWidth } from './bit-width.js';

@@ -0,0 +0,0 @@ import { ValueType } from './value-type.js';

@@ -0,0 +0,0 @@ import { fromByteWidth } from './bit-width-util.js';

@@ -0,0 +0,0 @@ import { Builder } from './builder.js';

@@ -0,0 +0,0 @@ import { BitWidth } from './bit-width.js';

@@ -0,0 +0,0 @@ import { ValueType } from './value-type.js';

@@ -0,0 +0,0 @@ import { ValueType } from './value-type.js';

@@ -0,0 +0,0 @@ export declare enum ValueType {

@@ -0,0 +0,0 @@ export var ValueType;

@@ -5,3 +5,3 @@ export { SIZEOF_SHORT } from './constants.js';

export { SIZE_PREFIX_LENGTH } from './constants.js';
export { Table, Offset } from './types.js';
export { Table, Offset, IGeneratedObject, IUnpackableObject } from './types.js';
export { int32, float32, float64, isLittleEndian } from './utils.js';

@@ -8,0 +8,0 @@ export { Encoding } from './encoding.js';

@@ -0,0 +0,0 @@ export { SIZEOF_SHORT } from './constants.js';

@@ -10,3 +10,5 @@ import { ByteBuffer } from './byte-buffer.js';

pack(builder: Builder): Offset;
unpack(): IGeneratedObject;
}
export interface IUnpackableObject<T> {
unpack(): T;
}
export {};

@@ -0,0 +0,0 @@ export declare const int32: Int32Array;

@@ -0,0 +0,0 @@ export const int32 = new Int32Array(2);

{
"name": "flatbuffers",
"version": "2.0.7",
"version": "22.10.25",
"description": "Memory Efficient Serialization Library",

@@ -19,4 +19,5 @@ "files": [

"scripts": {
"test": "npm run compile && cd tests && python3 ./TypeScriptTest.py",
"compile": "tsc && tsc -p tsconfig.mjs.json",
"test": "npm run compile && cd tests/ts && python3 ./TypeScriptTest.py",
"lint": "eslint ts",
"compile": "tsc && tsc -p tsconfig.mjs.json && rollup -c",
"prepublishOnly": "npm install --only=dev && npm run compile"

@@ -39,9 +40,10 @@ },

"devDependencies": {
"@bazel/typescript": "^5.2.0",
"@types/node": "17.0.21",
"@typescript-eslint/eslint-plugin": "^4.12.0",
"@typescript-eslint/parser": "^4.12.0",
"eslint": "^7.17.0",
"typescript": "^4.5.5"
"@bazel/typescript": "5.2.0",
"@types/node": "18.7.16",
"@typescript-eslint/eslint-plugin": "^5.36.2",
"@typescript-eslint/parser": "^5.36.2",
"eslint": "^8.23.1",
"rollup": "^2.79.0",
"typescript": "^4.8.3"
}
}

@@ -23,24 +23,30 @@ ![logo](http://google.github.io/flatbuffers/fpl_logo_small.png) FlatBuffers

* Android
* And any others with a recent C++ compiler.
* And any others with a recent C++ compiler (C++ 11 and newer)
## Supported programming languages
* C++
* C#
* C
* Dart
* Go
* Java
* JavaScript
* Lobster
* Lua
* PHP
* Python
* Rust
* Swift
* TypeScript
Code generation and runtime libraries for many popular languages.
1. C
1. C++ - [snapcraft.io](https://snapcraft.io/flatbuffers)
1. C# - [nuget.org](https://www.nuget.org/packages/Google.FlatBuffers)
1. Dart - [pub.dev](https://pub.dev/packages/flat_buffers)
1. Go - [go.dev](https://pkg.go.dev/github.com/google/flatbuffers/go)
1. Java - [Maven](https://search.maven.org/artifact/com.google.flatbuffers/flatbuffers-java)
1. JavaScript - [NPM](https://www.npmjs.com/package/flatbuffers)
1. Kotlin
1. Lobster
1. Lua
1. PHP
1. Python - [PyPi](https://pypi.org/project/flatbuffers/)
1. Rust - [crates.io](https://crates.io/crates/flatbuffers)
1. Swift
1. TypeScript - [NPM](https://www.npmjs.com/package/flatbuffers)
*and more in progress...*
1. [Nim](https://github.com/google/flatbuffers/pull/7362)
## Contribution
* [FlatBuffers Google Group][] to discuss FlatBuffers with other developers and users.
* [FlatBuffers Issues Tracker][] to submit an issue.

@@ -51,2 +57,9 @@ * [stackoverflow.com][] with [`flatbuffers` tag][] for any questions regarding FlatBuffers.

## Community
* [FlatBuffers Google Group][] to discuss FlatBuffers with other developers and users.
* [Discord Server](https:///discord.gg/6qgKs3R)
* [Gitter](https://gitter.im/google/flatbuffers)
## Security

@@ -53,0 +66,0 @@

@@ -552,3 +552,3 @@ import { ByteBuffer } from "./byte-buffer.js"

*/
createObjectOffset(obj: string | any): Offset {
createObjectOffset(obj: string | IGeneratedObject | null): Offset {
if(obj === null) {

@@ -570,3 +570,3 @@ return 0

*/
createObjectOffsetList(list: string[] | any[]): Offset[] {
createObjectOffsetList(list: (string | IGeneratedObject)[]): Offset[] {
const ret: number[] = [];

@@ -588,3 +588,3 @@

createStructOffsetList(list: string[] | any[], startFunc: (builder: Builder, length: number) => void): Offset {
createStructOffsetList(list: (string | IGeneratedObject)[], startFunc: (builder: Builder, length: number) => void): Offset {
startFunc(this, list.length);

@@ -591,0 +591,0 @@ this.createObjectOffsetList(list.slice().reverse());

import { FILE_IDENTIFIER_LENGTH, SIZEOF_INT } from "./constants.js";
import { int32, isLittleEndian, float32, float64 } from "./utils.js";
import { Offset, Table, IGeneratedObject } from "./types.js";
import { Offset, Table, IGeneratedObject, IUnpackableObject } from "./types.js";
import { Encoding } from "./encoding.js";

@@ -260,13 +260,13 @@

*/
createScalarList(listAccessor: (i: number) => unknown, listLength: number): any[] {
const ret: any[] = [];
createScalarList<T>(listAccessor: (i: number) => T | null, listLength: number): T[] {
const ret: T[] = [];
for(let i = 0; i < listLength; ++i) {
if(listAccessor(i) !== null) {
ret.push(listAccessor(i));
const val = listAccessor(i);
if(val !== null) {
ret.push(val);
}
}
return ret;
}
/**

@@ -278,14 +278,12 @@ * A helper function for generating list for obj api

*/
createObjList(listAccessor: (i: number) => unknown, listLength: number): any[] {
const ret: any[] = [];
createObjList<T1 extends IUnpackableObject<T2>, T2 extends IGeneratedObject>(listAccessor: (i: number) => T1 | null, listLength: number): T2[] {
const ret: T2[] = [];
for(let i = 0; i < listLength; ++i) {
const val = listAccessor(i);
if(val !== null) {
ret.push((val as IGeneratedObject).unpack());
ret.push(val.unpack());
}
}
return ret;
}
}

@@ -0,0 +0,0 @@ export const SIZEOF_SHORT = 2;

@@ -0,0 +0,0 @@ export enum Encoding {

@@ -0,0 +0,0 @@ /* eslint-disable @typescript-eslint/no-namespace */

@@ -0,0 +0,0 @@ import { BitWidth } from './bit-width.js'

@@ -0,0 +0,0 @@ export enum BitWidth {

@@ -0,0 +0,0 @@ import { BitWidth } from './bit-width.js'

@@ -0,0 +0,0 @@ export function fromUTF8Array(data: BufferSource): string {

@@ -0,0 +0,0 @@ import { BitWidth } from './bit-width.js'

@@ -0,0 +0,0 @@ import { fromByteWidth } from './bit-width-util.js'

@@ -0,0 +0,0 @@ import { Builder } from './builder.js'

@@ -0,0 +0,0 @@ import { ValueType } from './value-type.js'

@@ -0,0 +0,0 @@ export enum ValueType {

@@ -6,3 +6,3 @@ export { SIZEOF_SHORT } from './constants.js'

export { Table, Offset } from './types.js'
export { Table, Offset, IGeneratedObject, IUnpackableObject } from './types.js'

@@ -9,0 +9,0 @@ export { int32, float32, float64, isLittleEndian } from './utils.js'

@@ -13,3 +13,6 @@ import { ByteBuffer } from './byte-buffer.js'

pack(builder:Builder): Offset
unpack(): IGeneratedObject
}
export interface IUnpackableObject<T> {
unpack(): T
}

@@ -0,0 +0,0 @@ export const int32 = new Int32Array(2);

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