beanbagdb 0.5.4 → 0.5.41

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.
@@ -1,11 +1,11 @@
1
+ import require$$0$3, { fileURLToPath } from 'url';
2
+ import require$$1$2, { dirname } from 'path';
1
3
  import crypto$1, { scryptSync, randomBytes, createCipheriv, createDecipheriv } from 'crypto';
2
- import require$$0$3 from 'url';
3
4
  import require$$3$1 from 'http';
4
5
  import require$$4 from 'https';
5
6
  import require$$4$1 from 'assert';
6
7
  import require$$0$2 from 'util';
7
8
  import Stream$3 from 'stream';
8
- import require$$1$2 from 'path';
9
9
  import fs$2 from 'fs';
10
10
  import require$$0$4 from 'tty';
11
11
  import zlib$1 from 'zlib';
@@ -16,20 +16,124 @@ import require$$2 from 'os';
16
16
  import vm from 'vm';
17
17
 
18
18
  function _mergeNamespaces(n, m) {
19
- m.forEach(function (e) {
20
- e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
21
- if (k !== 'default' && !(k in n)) {
22
- var d = Object.getOwnPropertyDescriptor(e, k);
23
- Object.defineProperty(n, k, d.get ? d : {
24
- enumerable: true,
25
- get: function () { return e[k]; }
26
- });
27
- }
28
- });
29
- });
30
- return Object.freeze(n);
19
+ m.forEach(function (e) {
20
+ e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
21
+ if (k !== 'default' && !(k in n)) {
22
+ var d = Object.getOwnPropertyDescriptor(e, k);
23
+ Object.defineProperty(n, k, d.get ? d : {
24
+ enumerable: true,
25
+ get: function () { return e[k]; }
26
+ });
27
+ }
28
+ });
29
+ });
30
+ return Object.freeze(n);
31
31
  }
32
32
 
33
+ var name$1 = "beanbagdb";
34
+ var version$5 = "0.5.41";
35
+ var description$2 = "A JS library to introduce a schema layer to a No-SQL local database";
36
+ var main$1 = "dist/beanbagdb.esm.js";
37
+ var module = "dist/beanbagdb.esm.js";
38
+ var type$3 = "module";
39
+ var scripts$1 = {
40
+ test: "mocha",
41
+ build: "rollup -c",
42
+ prepublishOnly: "npm run build"
43
+ };
44
+ var repository$1 = {
45
+ type: "git",
46
+ url: "git+https://github.com/shubhvjain/beanbagdb.git"
47
+ };
48
+ var keywords$1 = [
49
+ "couchdb",
50
+ "pouchdb",
51
+ "local",
52
+ "database",
53
+ "schema"
54
+ ];
55
+ var author$1 = "svj";
56
+ var license$1 = "ISC";
57
+ var bugs = {
58
+ url: "https://github.com/shubhvjain/beanbagdb/issues"
59
+ };
60
+ var homepage$1 = "https://github.com/shubhvjain/beanbagdb#readme";
61
+ var dependencies$2 = {
62
+ ajv: "^8.12.0",
63
+ dotenv: "^16.4.5",
64
+ nano: "^10.1.3",
65
+ pouchdb: "^9.0.0",
66
+ "pouchdb-adapter-memory": "^9.0.0",
67
+ "pouchdb-find": "^9.0.0"
68
+ };
69
+ var devDependencies$1 = {
70
+ "@rollup/plugin-commonjs": "^26.0.1",
71
+ "@rollup/plugin-json": "^6.1.0",
72
+ "@rollup/plugin-node-resolve": "^15.2.3",
73
+ "@rollup/plugin-replace": "^5.0.7",
74
+ "@rollup/plugin-terser": "^0.4.4",
75
+ chai: "^5.1.1",
76
+ mocha: "^10.7.3",
77
+ rollup: "^4.21.2"
78
+ };
79
+ var pkg = {
80
+ name: name$1,
81
+ version: version$5,
82
+ description: description$2,
83
+ main: main$1,
84
+ module: module,
85
+ type: type$3,
86
+ scripts: scripts$1,
87
+ repository: repository$1,
88
+ keywords: keywords$1,
89
+ author: author$1,
90
+ license: license$1,
91
+ bugs: bugs,
92
+ homepage: homepage$1,
93
+ dependencies: dependencies$2,
94
+ devDependencies: devDependencies$1
95
+ };
96
+
97
+ // import { readFile } from 'fs/promises';
98
+ // import { fileURLToPath } from 'url';
99
+ // import { dirname, join } from 'path';
100
+
101
+ // // Get the current directory
102
+ // const __filename = fileURLToPath(import.meta.url);
103
+ // const __dirname = dirname(__filename);
104
+
105
+ // // Adjust path to point to the correct location of package.json (move up from /src)
106
+ // const packageJsonPath = join(__dirname, '../package.json'); // Adjust to point to the correct folder
107
+
108
+ // function isNode() {
109
+ // return typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
110
+ // }
111
+
112
+
113
+ // // Function to read package.json and get the version
114
+ // async function getPackageVersionNode() {
115
+ // try {
116
+ // const data = await readFile(packageJsonPath, 'utf-8');
117
+ // const packageJson = JSON.parse(data);
118
+ // return packageJson.version;
119
+ // } catch (error) {
120
+ // console.error('Error reading package.json:', error);
121
+ // throw error;
122
+ // }
123
+ // }
124
+
125
+ async function getPackageVersion() {
126
+ //if (isNode()) {
127
+ // return await getPackageVersionNode(); // Node.js environment
128
+ //} else {
129
+ // return "0.5.41"; // Browser environment
130
+ //}
131
+ return pkg.version
132
+ }
133
+
134
+ const __filename = fileURLToPath(import.meta.url);
135
+ dirname(__filename);
136
+
33
137
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
34
138
 
35
139
  function getDefaultExportFromCjs (x) {
@@ -3283,8 +3387,8 @@ function getJsonPointer(parsedRef, { baseId, schema, root }) {
3283
3387
  }
3284
3388
 
3285
3389
  var $id$1 = "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#";
3286
- var description$2 = "Meta-schema for $data reference (JSON AnySchema extension proposal)";
3287
- var type$3 = "object";
3390
+ var description$1 = "Meta-schema for $data reference (JSON AnySchema extension proposal)";
3391
+ var type$2 = "object";
3288
3392
  var required$2 = [
3289
3393
  "$data"
3290
3394
  ];
@@ -3304,8 +3408,8 @@ var properties$2 = {
3304
3408
  var additionalProperties$1 = false;
3305
3409
  var require$$9 = {
3306
3410
  $id: $id$1,
3307
- description: description$2,
3308
- type: type$3,
3411
+ description: description$1,
3412
+ type: type$2,
3309
3413
  required: required$2,
3310
3414
  properties: properties$2,
3311
3415
  additionalProperties: additionalProperties$1
@@ -6190,7 +6294,7 @@ const def$c = {
6190
6294
  };
6191
6295
  contains.default = def$c;
6192
6296
 
6193
- var dependencies$2 = {};
6297
+ var dependencies$1 = {};
6194
6298
 
6195
6299
  (function (exports) {
6196
6300
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -6277,7 +6381,7 @@ var dependencies$2 = {};
6277
6381
  exports.validateSchemaDeps = validateSchemaDeps;
6278
6382
  exports.default = def;
6279
6383
 
6280
- } (dependencies$2));
6384
+ } (dependencies$1));
6281
6385
 
6282
6386
  var propertyNames = {};
6283
6387
 
@@ -6768,7 +6872,7 @@ const prefixItems_1 = prefixItems;
6768
6872
  const items_1 = items;
6769
6873
  const items2020_1 = items2020;
6770
6874
  const contains_1 = contains;
6771
- const dependencies_1 = dependencies$2;
6875
+ const dependencies_1 = dependencies$1;
6772
6876
  const propertyNames_1 = propertyNames;
6773
6877
  const additionalProperties_1 = additionalProperties;
6774
6878
  const properties_1 = properties$1;
@@ -7099,7 +7203,7 @@ var definitions = {
7099
7203
  ]
7100
7204
  }
7101
7205
  };
7102
- var type$2 = [
7206
+ var type$1 = [
7103
7207
  "object",
7104
7208
  "boolean"
7105
7209
  ];
@@ -7300,7 +7404,7 @@ var require$$3 = {
7300
7404
  $id: $id,
7301
7405
  title: title,
7302
7406
  definitions: definitions,
7303
- type: type$2,
7407
+ type: type$1,
7304
7408
  properties: properties,
7305
7409
  "default": true
7306
7410
  };
@@ -7539,109 +7643,6 @@ const editable_metadata_schema = {
7539
7643
  }
7540
7644
  };
7541
7645
 
7542
- var name$1 = "beanbagdb";
7543
- var version$5 = "0.5.4";
7544
- var description$1 = "A JS library to introduce a schema layer to a No-SQL local database";
7545
- var main$1 = "dist/beanbagdb.esm.js";
7546
- var module = "dist/beanbagdb.esm.js";
7547
- var type$1 = "module";
7548
- var scripts$1 = {
7549
- test: "mocha",
7550
- build: "rollup -c",
7551
- prepublishOnly: "npm run build"
7552
- };
7553
- var repository$1 = {
7554
- type: "git",
7555
- url: "git+https://github.com/shubhvjain/beanbagdb.git"
7556
- };
7557
- var keywords$1 = [
7558
- "couchdb",
7559
- "pouchdb",
7560
- "local",
7561
- "database",
7562
- "schema"
7563
- ];
7564
- var author$1 = "svj";
7565
- var license$1 = "ISC";
7566
- var bugs = {
7567
- url: "https://github.com/shubhvjain/beanbagdb/issues"
7568
- };
7569
- var homepage$1 = "https://github.com/shubhvjain/beanbagdb#readme";
7570
- var dependencies$1 = {
7571
- ajv: "^8.12.0",
7572
- dotenv: "^16.4.5",
7573
- nano: "^10.1.3",
7574
- pouchdb: "^9.0.0",
7575
- "pouchdb-adapter-memory": "^9.0.0",
7576
- "pouchdb-find": "^9.0.0"
7577
- };
7578
- var devDependencies$1 = {
7579
- "@rollup/plugin-commonjs": "^26.0.1",
7580
- "@rollup/plugin-json": "^6.1.0",
7581
- "@rollup/plugin-node-resolve": "^15.2.3",
7582
- "@rollup/plugin-replace": "^5.0.7",
7583
- "@rollup/plugin-terser": "^0.4.4",
7584
- chai: "^5.1.1",
7585
- mocha: "^10.7.3",
7586
- rollup: "^4.21.2"
7587
- };
7588
- var pkg = {
7589
- name: name$1,
7590
- version: version$5,
7591
- description: description$1,
7592
- main: main$1,
7593
- module: module,
7594
- type: type$1,
7595
- scripts: scripts$1,
7596
- repository: repository$1,
7597
- keywords: keywords$1,
7598
- author: author$1,
7599
- license: license$1,
7600
- bugs: bugs,
7601
- homepage: homepage$1,
7602
- dependencies: dependencies$1,
7603
- devDependencies: devDependencies$1
7604
- };
7605
-
7606
- // import { readFile } from 'fs/promises';
7607
- // import { fileURLToPath } from 'url';
7608
- // import { dirname, join } from 'path';
7609
-
7610
- // // Get the current directory
7611
- // const __filename = fileURLToPath(import.meta.url);
7612
- // const __dirname = dirname(__filename);
7613
-
7614
- // // Adjust path to point to the correct location of package.json (move up from /src)
7615
- // const packageJsonPath = join(__dirname, '../package.json'); // Adjust to point to the correct folder
7616
-
7617
- // function isNode() {
7618
- // return typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
7619
- // }
7620
-
7621
-
7622
- // // Function to read package.json and get the version
7623
- // async function getPackageVersionNode() {
7624
- // try {
7625
- // const data = await readFile(packageJsonPath, 'utf-8');
7626
- // const packageJson = JSON.parse(data);
7627
- // return packageJson.version;
7628
- // } catch (error) {
7629
- // console.error('Error reading package.json:', error);
7630
- // throw error;
7631
- // }
7632
- // }
7633
-
7634
- async function getPackageVersion() {
7635
- //if (isNode()) {
7636
- // return await getPackageVersionNode(); // Node.js environment
7637
- //} else {
7638
- // return "0.5.4"; // Browser environment
7639
- //}
7640
- return pkg.version
7641
- }
7642
-
7643
- // getPackageVersion().then(version => console.log('Package version:', version));
7644
-
7645
7646
  /**
7646
7647
  * This the core class. it is not very useful in itself but can be used to generate a sub class for a specific database for eg CouchDB.
7647
7648
  * It takes a db_instance argument, which , this class relies on perform CRUD operations on the data.
@@ -113293,14 +113294,14 @@ const punycode$1 = {
113293
113294
  };
113294
113295
 
113295
113296
  var punycode_es6 = /*#__PURE__*/Object.freeze({
113296
- __proto__: null,
113297
- decode: decode$1,
113298
- default: punycode$1,
113299
- encode: encode$2,
113300
- toASCII: toASCII,
113301
- toUnicode: toUnicode,
113302
- ucs2decode: ucs2decode,
113303
- ucs2encode: ucs2encode
113297
+ __proto__: null,
113298
+ decode: decode$1,
113299
+ default: punycode$1,
113300
+ encode: encode$2,
113301
+ toASCII: toASCII,
113302
+ toUnicode: toUnicode,
113303
+ ucs2decode: ucs2decode,
113304
+ ucs2encode: ucs2encode
113304
113305
  });
113305
113306
 
113306
113307
  var require$$0 = /*@__PURE__*/getAugmentedNamespace(punycode_es6);
@@ -126181,27 +126182,27 @@ var PrefixSecurityEnum_1 = cookie.PrefixSecurityEnum = PrefixSecurityEnum;
126181
126182
  var ParameterError = cookie.ParameterError = validators.ParameterError;
126182
126183
 
126183
126184
  var tough = /*#__PURE__*/_mergeNamespaces({
126184
- __proto__: null,
126185
- Cookie: Cookie_1,
126186
- CookieJar: CookieJar_1,
126187
- MemoryCookieStore: MemoryCookieStore_1,
126188
- ParameterError: ParameterError,
126189
- PrefixSecurityEnum: PrefixSecurityEnum_1,
126190
- Store: Store_1,
126191
- canonicalDomain: canonicalDomain_1,
126192
- cookieCompare: cookieCompare_1,
126193
- default: cookie,
126194
- defaultPath: defaultPath_1,
126195
- domainMatch: domainMatch_1,
126196
- formatDate: formatDate_1,
126197
- fromJSON: fromJSON_1,
126198
- getPublicSuffix: getPublicSuffix,
126199
- parse: parse_1,
126200
- parseDate: parseDate_1,
126201
- pathMatch: pathMatch_1,
126202
- permuteDomain: permuteDomain,
126203
- permutePath: permutePath_1,
126204
- version: version$2
126185
+ __proto__: null,
126186
+ Cookie: Cookie_1,
126187
+ CookieJar: CookieJar_1,
126188
+ MemoryCookieStore: MemoryCookieStore_1,
126189
+ ParameterError: ParameterError,
126190
+ PrefixSecurityEnum: PrefixSecurityEnum_1,
126191
+ Store: Store_1,
126192
+ canonicalDomain: canonicalDomain_1,
126193
+ cookieCompare: cookieCompare_1,
126194
+ default: cookie,
126195
+ defaultPath: defaultPath_1,
126196
+ domainMatch: domainMatch_1,
126197
+ formatDate: formatDate_1,
126198
+ fromJSON: fromJSON_1,
126199
+ getPublicSuffix: getPublicSuffix,
126200
+ parse: parse_1,
126201
+ parseDate: parseDate_1,
126202
+ pathMatch: pathMatch_1,
126203
+ permuteDomain: permuteDomain,
126204
+ permutePath: permutePath_1,
126205
+ version: version$2
126205
126206
  }, [cookie]);
126206
126207
 
126207
126208
  var setCookie = {exports: {}};