meadow 2.0.41 → 2.0.43

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meadow",
3
- "version": "2.0.41",
3
+ "version": "2.0.43",
4
4
  "description": "A data access library.",
5
5
  "main": "source/Meadow.js",
6
6
  "scripts": {
@@ -28,6 +28,11 @@
28
28
  "docker-postgresql-status": "./scripts/postgresql-test-db.sh status",
29
29
  "test-postgresql": "./scripts/postgresql-test-db.sh start && npx quack test -g Meadow-Provider-PostgreSQL",
30
30
  "test-postgresql-all": "./scripts/postgresql-test-db.sh start && npx mocha -u tdd --exit -R spec",
31
+ "docker-oracle-start": "./scripts/oracle-test-db.sh start",
32
+ "docker-oracle-stop": "./scripts/oracle-test-db.sh stop",
33
+ "docker-oracle-status": "./scripts/oracle-test-db.sh status",
34
+ "test-oracle": "./scripts/oracle-test-db.sh start && npx quack test -g Meadow-Provider-Oracle",
35
+ "test-oracle-all": "./scripts/oracle-test-db.sh start && npx mocha -u tdd --exit -R spec",
31
36
  "docker-mongodb-start": "./scripts/mongodb-test-db.sh start",
32
37
  "docker-mongodb-stop": "./scripts/mongodb-test-db.sh stop",
33
38
  "docker-mongodb-status": "./scripts/mongodb-test-db.sh status",
@@ -43,7 +48,7 @@
43
48
  "test-alasql": "npx quack test -g Meadow-Provider-ALASQL",
44
49
  "test-sqlite-browser": "npx quack test -g Meadow-Provider-SQLiteBrowser",
45
50
  "test-sqlite-browser-headless": "npx mocha -u tdd --exit --timeout 60000 test/Meadow-Provider-SQLiteBrowser-Headless_tests.js",
46
- "test-all-providers": "./scripts/mysql-test-db.sh start && ./scripts/mssql-test-db.sh start && ./scripts/postgresql-test-db.sh start && ./scripts/mongodb-test-db.sh start && ./scripts/solr-test-db.sh start && ./scripts/dgraph-test-db.sh start && npx mocha -u tdd --exit -R spec",
51
+ "test-all-providers": "./scripts/mysql-test-db.sh start && ./scripts/mssql-test-db.sh start && ./scripts/postgresql-test-db.sh start && ./scripts/oracle-test-db.sh start && ./scripts/mongodb-test-db.sh start && ./scripts/solr-test-db.sh start && ./scripts/dgraph-test-db.sh start && npx mocha -u tdd --exit -R spec",
47
52
  "docker-cleanup": "./scripts/meadow-test-cleanup.sh",
48
53
  "test-cleanup": "./scripts/meadow-test-cleanup.sh"
49
54
  },
@@ -67,7 +72,7 @@
67
72
  },
68
73
  "repository": {
69
74
  "type": "git",
70
- "url": "https://github.com/stevenvelozo/meadow.git"
75
+ "url": "https://github.com/fable-retold/meadow.git"
71
76
  },
72
77
  "keywords": [
73
78
  "orm",
@@ -76,33 +81,35 @@
76
81
  "author": "Steven Velozo <steven@velozo.com> (http://velozo.com/)",
77
82
  "license": "MIT",
78
83
  "bugs": {
79
- "url": "https://github.com/stevenvelozo/meadow/issues"
84
+ "url": "https://github.com/fable-retold/meadow/issues"
80
85
  },
81
- "homepage": "https://github.com/stevenvelozo/meadow",
86
+ "homepage": "https://github.com/fable-retold/meadow",
82
87
  "devDependencies": {
83
88
  "alasql": "^4.17.0",
84
89
  "dgraph-js-http": "^21.3.0",
85
- "fable": "^3.1.72",
90
+ "fable": "^3.1.75",
86
91
  "gulp-util": "^3.0.8",
87
92
  "meadow-connection-dgraph": "^1.0.3",
88
93
  "meadow-connection-mongodb": "^1.0.3",
89
94
  "meadow-connection-mssql": "^1.0.23",
90
95
  "meadow-connection-mysql": "^1.0.19",
91
- "meadow-connection-postgresql": "^1.0.5",
96
+ "meadow-connection-oracle": "^1.0.2",
97
+ "meadow-connection-postgresql": "^1.0.7",
92
98
  "meadow-connection-rocksdb": "^1.0.0",
93
99
  "meadow-connection-solr": "^1.0.3",
94
100
  "meadow-connection-sqlite": "^1.0.20",
95
101
  "meadow-connection-sqlite-browser": "^1.0.2",
96
102
  "mongodb": "^6.12.0",
97
103
  "mysql2": "^3.18.2",
98
- "pict-docuserve": "^1.0.1",
104
+ "oracledb": "^6.10.0",
105
+ "pict-docuserve": "^1.4.12",
99
106
  "puppeteer": "^24.38.0",
100
- "quackage": "^1.2.3",
107
+ "quackage": "^1.3.0",
101
108
  "solr-client": "^0.9.0"
102
109
  },
103
110
  "dependencies": {
104
111
  "async": "3.2.6",
105
- "foxhound": "^2.0.27",
112
+ "foxhound": "^2.0.29",
106
113
  "is-my-json-valid": "2.20.6",
107
114
  "simple-get": "^4.0.1"
108
115
  }
@@ -496,6 +496,138 @@ function emitMSSQL()
496
496
  return tmpOut.join('\n');
497
497
  }
498
498
 
499
+ // ---------------------------------------------------------------------------
500
+ // Oracle emitter. Oracle has no CREATE TABLE IF NOT EXISTS; the docker script
501
+ // runs this seed once against a fresh container, so plain CREATE TABLE is fine.
502
+ // Output is sqlplus-friendly: SET DEFINE OFF stops the '&' in "Angels & Demons"
503
+ // from being read as a substitution variable, and WHENEVER SQLERROR EXIT
504
+ // FAILURE makes a bad statement fail the piped load. Identity columns + the
505
+ // 23ai multi-row VALUES clause keep it close to the other dialects.
506
+ // ---------------------------------------------------------------------------
507
+ function emitOracle()
508
+ {
509
+ const tmpOut = [];
510
+ tmpOut.push('-- Bookstore Schema and Seed Data for Meadow Oracle Tests');
511
+ tmpOut.push('-- Generated by scripts/bookstore-seed.js (GUIDs minted via fable-uuid)');
512
+ tmpOut.push('SET DEFINE OFF');
513
+ tmpOut.push('WHENEVER SQLERROR EXIT FAILURE');
514
+ tmpOut.push('');
515
+ tmpOut.push('CREATE TABLE Book');
516
+ tmpOut.push(' (');
517
+ tmpOut.push(' IDBook NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,');
518
+ tmpOut.push(' GUIDBook VARCHAR2(36) DEFAULT \'00000000-0000-0000-0000-000000000000\' NOT NULL,');
519
+ tmpOut.push(' CreateDate TIMESTAMP,');
520
+ tmpOut.push(' CreatingIDUser NUMBER DEFAULT 0 NOT NULL,');
521
+ tmpOut.push(' UpdateDate TIMESTAMP,');
522
+ tmpOut.push(' UpdatingIDUser NUMBER DEFAULT 0 NOT NULL,');
523
+ tmpOut.push(' Deleted NUMBER(1) DEFAULT 0 NOT NULL,');
524
+ tmpOut.push(' DeleteDate TIMESTAMP,');
525
+ tmpOut.push(' DeletingIDUser NUMBER DEFAULT 0 NOT NULL,');
526
+ tmpOut.push(' Title VARCHAR2(200) DEFAULT \' \' NOT NULL,');
527
+ tmpOut.push(' Type VARCHAR2(32) DEFAULT \' \' NOT NULL,');
528
+ tmpOut.push(' Genre VARCHAR2(128) DEFAULT \' \' NOT NULL,');
529
+ tmpOut.push(' ISBN VARCHAR2(64) DEFAULT \' \' NOT NULL,');
530
+ tmpOut.push(' Language VARCHAR2(12) DEFAULT \' \' NOT NULL,');
531
+ tmpOut.push(' ImageURL VARCHAR2(254) DEFAULT \' \' NOT NULL,');
532
+ tmpOut.push(' PublicationYear NUMBER DEFAULT 0 NOT NULL');
533
+ tmpOut.push(' );');
534
+ tmpOut.push('');
535
+ tmpOut.push('CREATE TABLE BookAuthorJoin');
536
+ tmpOut.push(' (');
537
+ tmpOut.push(' IDBookAuthorJoin NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,');
538
+ tmpOut.push(' GUIDBookAuthorJoin VARCHAR2(36) DEFAULT \'00000000-0000-0000-0000-000000000000\' NOT NULL,');
539
+ tmpOut.push(' IDBook NUMBER DEFAULT 0 NOT NULL,');
540
+ tmpOut.push(' IDAuthor NUMBER DEFAULT 0 NOT NULL');
541
+ tmpOut.push(' );');
542
+ tmpOut.push('');
543
+ tmpOut.push('CREATE TABLE Author');
544
+ tmpOut.push(' (');
545
+ tmpOut.push(' IDAuthor NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,');
546
+ tmpOut.push(' GUIDAuthor VARCHAR2(36) DEFAULT \'00000000-0000-0000-0000-000000000000\' NOT NULL,');
547
+ tmpOut.push(' CreateDate TIMESTAMP,');
548
+ tmpOut.push(' CreatingIDUser NUMBER DEFAULT 0 NOT NULL,');
549
+ tmpOut.push(' UpdateDate TIMESTAMP,');
550
+ tmpOut.push(' UpdatingIDUser NUMBER DEFAULT 0 NOT NULL,');
551
+ tmpOut.push(' Deleted NUMBER(1) DEFAULT 0 NOT NULL,');
552
+ tmpOut.push(' DeleteDate TIMESTAMP,');
553
+ tmpOut.push(' DeletingIDUser NUMBER DEFAULT 0 NOT NULL,');
554
+ tmpOut.push(' Name VARCHAR2(200) DEFAULT \' \' NOT NULL');
555
+ tmpOut.push(' );');
556
+ tmpOut.push('');
557
+ tmpOut.push('CREATE TABLE BookPrice');
558
+ tmpOut.push(' (');
559
+ tmpOut.push(' IDBookPrice NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,');
560
+ tmpOut.push(' GUIDBookPrice VARCHAR2(36) DEFAULT \'00000000-0000-0000-0000-000000000000\' NOT NULL,');
561
+ tmpOut.push(' CreateDate TIMESTAMP,');
562
+ tmpOut.push(' CreatingIDUser NUMBER DEFAULT 0 NOT NULL,');
563
+ tmpOut.push(' UpdateDate TIMESTAMP,');
564
+ tmpOut.push(' UpdatingIDUser NUMBER DEFAULT 0 NOT NULL,');
565
+ tmpOut.push(' Deleted NUMBER(1) DEFAULT 0 NOT NULL,');
566
+ tmpOut.push(' DeleteDate TIMESTAMP,');
567
+ tmpOut.push(' DeletingIDUser NUMBER DEFAULT 0 NOT NULL,');
568
+ tmpOut.push(' Price NUMBER(8,2),');
569
+ tmpOut.push(' StartDate TIMESTAMP,');
570
+ tmpOut.push(' EndDate TIMESTAMP,');
571
+ tmpOut.push(' Discountable NUMBER(1) DEFAULT 0 NOT NULL,');
572
+ tmpOut.push(' CouponCode VARCHAR2(16) DEFAULT \' \' NOT NULL,');
573
+ tmpOut.push(' IDBook NUMBER DEFAULT 0 NOT NULL');
574
+ tmpOut.push(' );');
575
+ tmpOut.push('');
576
+ tmpOut.push('CREATE TABLE Review');
577
+ tmpOut.push(' (');
578
+ tmpOut.push(' IDReviews NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,');
579
+ tmpOut.push(' GUIDReviews VARCHAR2(36) DEFAULT \'00000000-0000-0000-0000-000000000000\' NOT NULL,');
580
+ tmpOut.push(' CreateDate TIMESTAMP,');
581
+ tmpOut.push(' CreatingIDUser NUMBER DEFAULT 0 NOT NULL,');
582
+ tmpOut.push(' UpdateDate TIMESTAMP,');
583
+ tmpOut.push(' UpdatingIDUser NUMBER DEFAULT 0 NOT NULL,');
584
+ tmpOut.push(' Deleted NUMBER(1) DEFAULT 0 NOT NULL,');
585
+ tmpOut.push(' DeleteDate TIMESTAMP,');
586
+ tmpOut.push(' DeletingIDUser NUMBER DEFAULT 0 NOT NULL,');
587
+ tmpOut.push(' Text CLOB,');
588
+ tmpOut.push(' Rating NUMBER DEFAULT 0 NOT NULL,');
589
+ tmpOut.push(' IDBook NUMBER DEFAULT 0 NOT NULL');
590
+ tmpOut.push(' );');
591
+ tmpOut.push('');
592
+ tmpOut.push('-- Seed Data: First 20 books from books.csv');
593
+ tmpOut.push('-- Inserted in CSV order so IDBook matches CSV row number');
594
+ tmpOut.push('');
595
+ tmpOut.push('INSERT INTO Book (GUIDBook, Title, Type, Genre, ISBN, Language, ImageURL, PublicationYear, CreateDate, CreatingIDUser, UpdateDate, UpdatingIDUser) VALUES');
596
+ const tmpBookRows = BOOKS.map((pBook) =>
597
+ {
598
+ return ' (' + [
599
+ sqlQuote(tmpUUID.getUUID()),
600
+ sqlQuote(pBook.Title),
601
+ sqlQuote(pBook.Type),
602
+ sqlQuote(pBook.Genre),
603
+ sqlQuote(pBook.ISBN),
604
+ sqlQuote(pBook.Language),
605
+ sqlQuote(pBook.ImageURL),
606
+ pBook.PublicationYear,
607
+ 'SYS_EXTRACT_UTC(SYSTIMESTAMP)', '99999', 'SYS_EXTRACT_UTC(SYSTIMESTAMP)', '99999'
608
+ ].join(', ') + ')';
609
+ });
610
+ tmpOut.push(tmpBookRows.join(',\n') + ';');
611
+ tmpOut.push('');
612
+ tmpOut.push('-- Seed Data: Authors for the first 20 books');
613
+ tmpOut.push('');
614
+ tmpOut.push('INSERT INTO Author (GUIDAuthor, Name, CreateDate, CreatingIDUser, UpdateDate, UpdatingIDUser) VALUES');
615
+ const tmpAuthorRows = AUTHORS.map((pName) =>
616
+ {
617
+ return ' (' + [
618
+ sqlQuote(tmpUUID.getUUID()),
619
+ sqlQuote(pName),
620
+ 'SYS_EXTRACT_UTC(SYSTIMESTAMP)', '99999', 'SYS_EXTRACT_UTC(SYSTIMESTAMP)', '99999'
621
+ ].join(', ') + ')';
622
+ });
623
+ tmpOut.push(tmpAuthorRows.join(',\n') + ';');
624
+ tmpOut.push('');
625
+ tmpOut.push('COMMIT;');
626
+ tmpOut.push('EXIT');
627
+ tmpOut.push('');
628
+ return tmpOut.join('\n');
629
+ }
630
+
499
631
  // ---------------------------------------------------------------------------
500
632
  // CLI
501
633
  // ---------------------------------------------------------------------------
@@ -532,7 +664,10 @@ switch (tmpDialect)
532
664
  case 'mssql':
533
665
  process.stdout.write(emitMSSQL());
534
666
  break;
667
+ case 'oracle':
668
+ process.stdout.write(emitOracle());
669
+ break;
535
670
  default:
536
- process.stderr.write('Usage: bookstore-seed.js --dialect <mysql|postgresql|mssql>\n');
671
+ process.stderr.write('Usage: bookstore-seed.js --dialect <mysql|postgresql|mssql|oracle>\n');
537
672
  process.exit(1);
538
673
  }
@@ -14,6 +14,7 @@ echo ""
14
14
  "${SCRIPT_DIR}/mysql-test-db.sh" stop
15
15
  "${SCRIPT_DIR}/mssql-test-db.sh" stop
16
16
  "${SCRIPT_DIR}/postgresql-test-db.sh" stop
17
+ "${SCRIPT_DIR}/oracle-test-db.sh" stop
17
18
  "${SCRIPT_DIR}/mongodb-test-db.sh" stop
18
19
  "${SCRIPT_DIR}/solr-test-db.sh" stop
19
20
  "${SCRIPT_DIR}/dgraph-test-db.sh" stop
@@ -0,0 +1,128 @@
1
+ #!/bin/bash
2
+ # Oracle Test Database Management Script
3
+ #
4
+ # Usage:
5
+ # ./scripts/oracle-test-db.sh start - Start Oracle container, load schema and seed data
6
+ # ./scripts/oracle-test-db.sh stop - Stop and remove the container
7
+ # ./scripts/oracle-test-db.sh status - Check if the container is running
8
+ #
9
+ # Uses gvenzl/oracle-free (Oracle Database 23ai Free — no license required,
10
+ # multi-arch so it runs natively on Apple Silicon). gvenzl auto-creates the
11
+ # APP_USER in its own schema inside the FREEPDB1 pluggable database.
12
+ #
13
+ # The container settings match the test configuration in
14
+ # test/Meadow-Provider-Oracle_tests.js and meadow-connection-oracle:
15
+ # Host: 127.0.0.1, Port: 21521, Service: FREEPDB1
16
+ # User: bookstore, Password: Retold1234567890!
17
+
18
+ CONTAINER_NAME="meadow-oracle-test"
19
+ ORACLE_USER="bookstore"
20
+ ORACLE_PASSWORD="Retold1234567890!"
21
+ ORACLE_SERVICE="FREEPDB1"
22
+ ORACLE_PORT="21521"
23
+ ORACLE_IMAGE="gvenzl/oracle-free:23-slim"
24
+
25
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
26
+ SEED_GENERATOR="${SCRIPT_DIR}/bookstore-seed.js"
27
+
28
+ start_oracle() {
29
+ # Check if container already exists
30
+ if docker ps -a --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
31
+ if docker ps --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
32
+ echo "Oracle test container is already running."
33
+ return 0
34
+ else
35
+ echo "Removing stopped container..."
36
+ docker rm "${CONTAINER_NAME}" > /dev/null 2>&1
37
+ fi
38
+ fi
39
+
40
+ echo "Starting Oracle test container (first boot pulls the image and initializes the DB; this can take several minutes)..."
41
+ docker run -d \
42
+ --name "${CONTAINER_NAME}" \
43
+ -e ORACLE_PASSWORD="${ORACLE_PASSWORD}" \
44
+ -e APP_USER="${ORACLE_USER}" \
45
+ -e APP_USER_PASSWORD="${ORACLE_PASSWORD}" \
46
+ -p "${ORACLE_PORT}:1521" \
47
+ "${ORACLE_IMAGE}"
48
+
49
+ if [ $? -ne 0 ]; then
50
+ echo "ERROR: Failed to start Oracle container."
51
+ exit 1
52
+ fi
53
+
54
+ echo "Waiting for Oracle to accept connections (gvenzl healthcheck)..."
55
+ RETRIES=120
56
+ until docker exec "${CONTAINER_NAME}" healthcheck.sh > /dev/null 2>&1; do
57
+ RETRIES=$((RETRIES - 1))
58
+ if [ $RETRIES -le 0 ]; then
59
+ echo "ERROR: Oracle failed to become ready in time."
60
+ docker logs "${CONTAINER_NAME}" 2>&1 | tail -20
61
+ exit 1
62
+ fi
63
+ echo " ...waiting (${RETRIES} retries left)"
64
+ sleep 5
65
+ done
66
+
67
+ # Load bookstore schema and seed data (GUIDs minted at generation time via fable-uuid)
68
+ if [ -f "${SEED_GENERATOR}" ]; then
69
+ echo "Loading bookstore schema and seed data..."
70
+ node "${SEED_GENERATOR}" --dialect oracle | \
71
+ docker exec -i "${CONTAINER_NAME}" sqlplus -S "${ORACLE_USER}/${ORACLE_PASSWORD}@//localhost:1521/${ORACLE_SERVICE}"
72
+ if [ $? -ne 0 ]; then
73
+ echo "WARNING: Failed to load seed data. Tests requiring pre-populated data may fail."
74
+ else
75
+ echo "Bookstore schema and seed data loaded successfully."
76
+ fi
77
+ else
78
+ echo "WARNING: Seed generator not found at ${SEED_GENERATOR}. Skipping schema/data loading."
79
+ fi
80
+
81
+ echo ""
82
+ echo "Oracle test database is ready!"
83
+ echo " Container: ${CONTAINER_NAME}"
84
+ echo " Host: 127.0.0.1:${ORACLE_PORT}"
85
+ echo " Service: ${ORACLE_SERVICE}"
86
+ echo " User: ${ORACLE_USER}"
87
+ echo " Password: ${ORACLE_PASSWORD}"
88
+ echo ""
89
+ echo "Run tests with: npm test"
90
+ }
91
+
92
+ stop_oracle() {
93
+ if docker ps -a --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
94
+ echo "Stopping and removing Oracle test container..."
95
+ docker stop "${CONTAINER_NAME}" > /dev/null 2>&1
96
+ docker rm "${CONTAINER_NAME}" > /dev/null 2>&1
97
+ echo "Oracle test container removed."
98
+ else
99
+ echo "No Oracle test container found."
100
+ fi
101
+ }
102
+
103
+ status_oracle() {
104
+ if docker ps --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
105
+ echo "Oracle test container is running."
106
+ docker ps --filter "name=${CONTAINER_NAME}" --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
107
+ elif docker ps -a --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
108
+ echo "Oracle test container exists but is stopped."
109
+ else
110
+ echo "Oracle test container is not running."
111
+ fi
112
+ }
113
+
114
+ case "${1}" in
115
+ start)
116
+ start_oracle
117
+ ;;
118
+ stop)
119
+ stop_oracle
120
+ ;;
121
+ status)
122
+ status_oracle
123
+ ;;
124
+ *)
125
+ echo "Usage: $0 {start|stop|status}"
126
+ exit 1
127
+ ;;
128
+ esac
package/source/Meadow.js CHANGED
@@ -138,6 +138,7 @@ var Meadow = function()
138
138
  'MSSQL': require(`./providers/Meadow-Provider-MSSQL.js`),
139
139
  'SQLite': require(`./providers/Meadow-Provider-SQLite.js`),
140
140
  'PostgreSQL': require(`./providers/Meadow-Provider-PostgreSQL.js`),
141
+ 'Oracle': require(`./providers/Meadow-Provider-Oracle.js`),
141
142
  'MongoDB': require(`./providers/Meadow-Provider-MongoDB.js`),
142
143
  'DGraph': require(`./providers/Meadow-Provider-DGraph.js`),
143
144
  'Solr': require(`./providers/Meadow-Provider-Solr.js`),
@@ -45,7 +45,7 @@ var MeadowProvider = function()
45
45
  };
46
46
 
47
47
  // Create a table for this schema on the fly
48
- // This is ripped off from https://github.com/stevenvelozo/stricture/blob/master/source/Stricture-Generate-MySQL.js
48
+ // This is ripped off from https://github.com/fable-retold/stricture/blob/master/source/Stricture-Generate-MySQL.js
49
49
  var createTableDynamically = () =>
50
50
  {
51
51
  var tmpCreateStatement = '';