protoobject 2.1.2 → 2.1.6

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.
@@ -40,8 +40,8 @@ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, p
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
41
  exports.ProtoObjectSQLite = exports.RecordState = void 0;
42
42
  const node_crypto_1 = require("node:crypto");
43
- const proto_object_1 = require("./proto-object");
44
- const static_implements_1 = require("../decorators/static-implements");
43
+ const proto_object_js_1 = require("./proto-object.js");
44
+ const static_implements_js_1 = require("../decorators/static-implements.js");
45
45
  /* eslint-disable no-unused-vars, @typescript-eslint/no-shadow */
46
46
  var RecordState;
47
47
  (function (RecordState) {
@@ -54,11 +54,11 @@ var RecordState;
54
54
  * Extends ProtoObject with database operations using node:sqlite
55
55
  */
56
56
  let ProtoObjectSQLite = (() => {
57
- let _classDecorators = [(0, static_implements_1.StaticImplements)()];
57
+ let _classDecorators = [(0, static_implements_js_1.StaticImplements)()];
58
58
  let _classDescriptor;
59
59
  let _classExtraInitializers = [];
60
60
  let _classThis;
61
- let _classSuper = proto_object_1.ProtoObject;
61
+ let _classSuper = proto_object_js_1.ProtoObject;
62
62
  var ProtoObjectSQLite = _classThis = class extends _classSuper {
63
63
  constructor(data) {
64
64
  super(data);
@@ -4,11 +4,15 @@
4
4
  * @description Provides methods for efficient streaming serialization and deserialization
5
5
  * @author Siarhei Dudko <siarhei@dudko.dev>
6
6
  */
7
+ var __importDefault = (this && this.__importDefault) || function (mod) {
8
+ return (mod && mod.__esModule) ? mod : { "default": mod };
9
+ };
7
10
  Object.defineProperty(exports, "__esModule", { value: true });
8
11
  exports.ProtoObjectStream = void 0;
9
12
  /* eslint-disable no-unused-vars */
10
13
  const node_stream_1 = require("node:stream");
11
- const objectstream_1 = require("@sergdudko/objectstream");
14
+ const objectstream_1 = __importDefault(require("@sergdudko/objectstream"));
15
+ const { Stringifer, Parser } = objectstream_1.default;
12
16
  /**
13
17
  * Utility class for streaming ProtoObject serialization using @sergdudko/objectstream
14
18
  */
@@ -26,7 +30,7 @@ class ProtoObjectStream {
26
30
  const plainObject = chunk && typeof chunk.toJSON === "function"
27
31
  ? chunk.toJSON()
28
32
  : chunk;
29
- const stringifer = new objectstream_1.Stringifer();
33
+ const stringifer = new Stringifer();
30
34
  let result = "";
31
35
  stringifer.on("data", (data) => {
32
36
  result += data.toString();
@@ -56,7 +60,7 @@ class ProtoObjectStream {
56
60
  objectMode: true,
57
61
  transform(chunk, encoding, callback) {
58
62
  try {
59
- const parser = new objectstream_1.Parser();
63
+ const parser = new Parser();
60
64
  parser.on("data", (obj) => {
61
65
  // Convert plain object back to ProtoObject instance if fromJSON exists
62
66
  const result = objectClass && typeof objectClass.fromJSON === "function"
@@ -99,7 +103,7 @@ class ProtoObjectStream {
99
103
  try {
100
104
  if (Buffer.isBuffer(chunk)) {
101
105
  // Buffer to object - deserialize
102
- const parser = new objectstream_1.Parser();
106
+ const parser = new Parser();
103
107
  parser.on("data", (obj) => {
104
108
  const result = objectClass &&
105
109
  typeof objectClass.fromJSON === "function"
@@ -118,7 +122,7 @@ class ProtoObjectStream {
118
122
  !Buffer.isBuffer(chunk)) {
119
123
  // Object to buffer - serialize (but not if it's already a Buffer)
120
124
  const plainObject = chunk.toJSON();
121
- const stringifer = new objectstream_1.Stringifer();
125
+ const stringifer = new Stringifer();
122
126
  let result = "";
123
127
  stringifer.on("data", (data) => {
124
128
  result += data.toString();
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.protoObjectFactory = protoObjectFactory;
4
- const proto_object_1 = require("../classes/proto-object");
4
+ const proto_object_js_1 = require("../classes/proto-object.js");
5
5
  /**
6
6
  * A factory for creating classes based on the ProtoObject class
7
7
  *
@@ -9,7 +9,7 @@ const proto_object_1 = require("../classes/proto-object");
9
9
  * @returns - an ProtoObject's heir
10
10
  */
11
11
  function protoObjectFactory(methods) {
12
- class CProtoObject extends proto_object_1.ProtoObject {
12
+ class CProtoObject extends proto_object_js_1.ProtoObject {
13
13
  constructor(data) {
14
14
  super(data);
15
15
  if (methods) {
@@ -37,8 +37,8 @@ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, p
37
37
  return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
38
38
  };
39
39
  import { randomUUID } from "node:crypto";
40
- import { ProtoObject } from "./proto-object";
41
- import { StaticImplements } from "../decorators/static-implements";
40
+ import { ProtoObject } from "./proto-object.js";
41
+ import { StaticImplements } from "../decorators/static-implements.js";
42
42
  /* eslint-disable no-unused-vars, @typescript-eslint/no-shadow */
43
43
  export var RecordState;
44
44
  (function (RecordState) {
@@ -5,7 +5,8 @@
5
5
  */
6
6
  /* eslint-disable no-unused-vars */
7
7
  import { Transform } from "node:stream";
8
- import { Stringifer, Parser } from "@sergdudko/objectstream";
8
+ import pkg from "@sergdudko/objectstream";
9
+ const { Stringifer, Parser } = pkg;
9
10
  /**
10
11
  * Utility class for streaming ProtoObject serialization using @sergdudko/objectstream
11
12
  */
@@ -1,4 +1,4 @@
1
- import { ProtoObject } from "../classes/proto-object";
1
+ import { ProtoObject } from "../classes/proto-object.js";
2
2
  /**
3
3
  * A factory for creating classes based on the ProtoObject class
4
4
  *
@@ -1,6 +1,6 @@
1
1
  import { DatabaseSync } from "node:sqlite";
2
- import { ProtoObject } from "./proto-object";
3
- import { ProtoObjectStaticMethods } from "../types/static-methods";
2
+ import { ProtoObject } from "./proto-object.js";
3
+ import { ProtoObjectStaticMethods } from "../types/static-methods.js";
4
4
  export declare enum RecordState {
5
5
  ACTIVE = 0,
6
6
  DELETED = 1
@@ -1,6 +1,6 @@
1
- import { UnknownObject } from "../types/unknown-object";
2
- import { ProtoObjectDynamicMethods } from "../types/dynamic-methods";
3
- import { ValidatorFunction } from "../types/validator-function";
1
+ import { UnknownObject } from "../types/unknown-object.js";
2
+ import { ProtoObjectDynamicMethods } from "../types/dynamic-methods.js";
3
+ import { ValidatorFunction } from "../types/validator-function.js";
4
4
  /**
5
5
  * A universal class for creating any JSON objects and simple manipulations with them.
6
6
  */
@@ -1,4 +1,4 @@
1
- import { ProtoObjectDynamicMethods } from "./dynamic-methods";
1
+ import { ProtoObjectDynamicMethods } from "./dynamic-methods.js";
2
2
  /**
3
3
  * A data transformer for the array of ProtoObject classes or its heirs
4
4
  *
@@ -1,4 +1,4 @@
1
- import { AnyObject } from "./any-object";
1
+ import { AnyObject } from "./any-object.js";
2
2
  /**
3
3
  * Dynamic methods of the ProtoObject class and its heirs
4
4
  */
@@ -1,4 +1,4 @@
1
- import { ProtoObjectDynamicMethods } from "./dynamic-methods";
1
+ import { ProtoObjectDynamicMethods } from "./dynamic-methods.js";
2
2
  /**
3
3
  * A data transformer for the ProtoObject class or its heir
4
4
  *
@@ -1,9 +1,9 @@
1
- import { AnyObject } from "./any-object";
2
- import { UnknownObject } from "./unknown-object";
3
- import { RecordTransformer } from "./record-transformer";
4
- import { ProtoObjectDynamicMethods } from "./dynamic-methods";
5
- import { CollectionTransformer } from "./collection-transformer";
6
- import { ValidatorFunction } from "./validator-function";
1
+ import { AnyObject } from "./any-object.js";
2
+ import { UnknownObject } from "./unknown-object.js";
3
+ import { RecordTransformer } from "./record-transformer.js";
4
+ import { ProtoObjectDynamicMethods } from "./dynamic-methods.js";
5
+ import { CollectionTransformer } from "./collection-transformer.js";
6
+ import { ValidatorFunction } from "./validator-function.js";
7
7
  /**
8
8
  * Static methods of the ProtoObject class and its heirs
9
9
  */
@@ -1,7 +1,7 @@
1
- import { ProtoObject } from "../classes/proto-object";
2
- import { ProtoObjectStaticMethods } from "../types/static-methods";
3
- import type { StorageType, StorageOptions } from "../types/browser-storage";
4
- export type { StorageType, StorageOptions } from "../types/browser-storage";
1
+ import { ProtoObject } from "../classes/proto-object.js";
2
+ import { ProtoObjectStaticMethods } from "../types/static-methods.js";
3
+ import type { StorageType, StorageOptions } from "../types/browser-storage.js";
4
+ export type { StorageType, StorageOptions } from "../types/browser-storage.js";
5
5
  /**
6
6
  * Universal ProtoObject browser storage utility
7
7
  * Supports localStorage, sessionStorage, IndexedDB, cookies, BroadcastChannel, and Web Workers
@@ -1,5 +1,5 @@
1
- import { ProtoObjectDynamicMethods } from "../types/dynamic-methods";
2
- import { ProtoObjectStaticMethods } from "../types/static-methods";
1
+ import { ProtoObjectDynamicMethods } from "../types/dynamic-methods.js";
2
+ import { ProtoObjectStaticMethods } from "../types/static-methods.js";
3
3
  /**
4
4
  * A factory for creating classes based on the ProtoObject class
5
5
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "protoobject",
3
- "version": "2.1.2",
3
+ "version": "2.1.6",
4
4
  "description": "A universal class for creating any JSON objects and simple manipulations with them.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -104,21 +104,23 @@
104
104
  ],
105
105
  "homepage": "https://github.com/dudko-dev/protoobject",
106
106
  "devDependencies": {
107
- "@eslint/js": "^9.37.0",
107
+ "@eslint/js": "^9.38.0",
108
108
  "@types/node": "^22.4.1",
109
- "eslint": "^9.37.0",
109
+ "eslint": "^9.38.0",
110
110
  "nyc": "^17.1.0",
111
111
  "prettier": "^3.5.2",
112
112
  "tsx": "^4.20.6",
113
113
  "typescript": "^5.9.3",
114
114
  "typescript-eslint": "^8.46.1"
115
115
  },
116
- "engines": {},
116
+ "engines": {
117
+ "node": ">=16"
118
+ },
117
119
  "directorie": {
118
120
  "man": "./docs/",
119
121
  "test": "./test/"
120
122
  },
121
123
  "dependencies": {
122
- "@sergdudko/objectstream": "^4.0.5"
124
+ "@sergdudko/objectstream": "^4.0.8"
123
125
  }
124
126
  }