meadow 2.0.23 → 2.0.26

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.
Files changed (59) hide show
  1. package/README.md +110 -141
  2. package/docs/README.md +34 -230
  3. package/docs/_cover.md +14 -0
  4. package/docs/_sidebar.md +44 -12
  5. package/docs/_topbar.md +5 -0
  6. package/docs/api/doCount.md +109 -0
  7. package/docs/api/doCreate.md +132 -0
  8. package/docs/api/doDelete.md +101 -0
  9. package/docs/api/doRead.md +122 -0
  10. package/docs/api/doReads.md +136 -0
  11. package/docs/api/doUndelete.md +98 -0
  12. package/docs/api/doUpdate.md +129 -0
  13. package/docs/api/getRoleName.md +84 -0
  14. package/docs/api/loadFromPackage.md +153 -0
  15. package/docs/api/marshalRecordFromSourceToObject.md +92 -0
  16. package/docs/api/query.md +133 -0
  17. package/docs/api/rawQueries.md +197 -0
  18. package/docs/api/reference.md +117 -0
  19. package/docs/api/setAuthorizer.md +103 -0
  20. package/docs/api/setDefault.md +90 -0
  21. package/docs/api/setDefaultIdentifier.md +84 -0
  22. package/docs/api/setDomain.md +56 -0
  23. package/docs/api/setIDUser.md +91 -0
  24. package/docs/api/setJsonSchema.md +92 -0
  25. package/docs/api/setProvider.md +87 -0
  26. package/docs/api/setSchema.md +107 -0
  27. package/docs/api/setScope.md +68 -0
  28. package/docs/api/validateObject.md +119 -0
  29. package/docs/architecture.md +316 -0
  30. package/docs/audit-tracking.md +226 -0
  31. package/docs/configuration.md +317 -0
  32. package/docs/providers/meadow-endpoints.md +306 -0
  33. package/docs/providers/mongodb.md +319 -0
  34. package/docs/providers/postgresql.md +312 -0
  35. package/docs/providers/rocksdb.md +297 -0
  36. package/docs/query-dsl.md +269 -0
  37. package/docs/quick-start.md +384 -0
  38. package/docs/raw-queries.md +193 -0
  39. package/docs/retold-catalog.json +61 -1
  40. package/docs/retold-keyword-index.json +15860 -4839
  41. package/docs/soft-deletes.md +224 -0
  42. package/package.json +36 -9
  43. package/scripts/bookstore-seed-postgresql.sql +135 -0
  44. package/scripts/dgraph-test-db.sh +144 -0
  45. package/scripts/meadow-test-cleanup.sh +5 -1
  46. package/scripts/mongodb-test-db.sh +98 -0
  47. package/scripts/postgresql-test-db.sh +124 -0
  48. package/scripts/solr-test-db.sh +135 -0
  49. package/source/Meadow.js +5 -0
  50. package/source/providers/Meadow-Provider-DGraph.js +679 -0
  51. package/source/providers/Meadow-Provider-MongoDB.js +527 -0
  52. package/source/providers/Meadow-Provider-PostgreSQL.js +361 -0
  53. package/source/providers/Meadow-Provider-RocksDB.js +1300 -0
  54. package/source/providers/Meadow-Provider-Solr.js +726 -0
  55. package/test/Meadow-Provider-DGraph_tests.js +741 -0
  56. package/test/Meadow-Provider-MongoDB_tests.js +661 -0
  57. package/test/Meadow-Provider-PostgreSQL_tests.js +787 -0
  58. package/test/Meadow-Provider-RocksDB_tests.js +887 -0
  59. package/test/Meadow-Provider-Solr_tests.js +679 -0
@@ -0,0 +1,98 @@
1
+ #!/bin/bash
2
+ # MongoDB Test Database Management Script
3
+ #
4
+ # Usage:
5
+ # ./scripts/mongodb-test-db.sh start - Start MongoDB container and wait for readiness
6
+ # ./scripts/mongodb-test-db.sh stop - Stop and remove the container
7
+ # ./scripts/mongodb-test-db.sh status - Check if the container is running
8
+ #
9
+ # The container settings match the test configuration in
10
+ # test/Meadow-Provider-MongoDB_tests.js:
11
+ # Host: 127.0.0.1, Port: 37017, Database: meadow_test
12
+
13
+ CONTAINER_NAME="meadow-mongodb-test"
14
+ MONGODB_PORT="37017"
15
+ MONGODB_IMAGE="mongo:7"
16
+
17
+ start_mongodb() {
18
+ # Check if container already exists
19
+ if docker ps -a --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
20
+ if docker ps --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
21
+ echo "MongoDB test container is already running."
22
+ return 0
23
+ else
24
+ echo "Removing stopped container..."
25
+ docker rm "${CONTAINER_NAME}" > /dev/null 2>&1
26
+ fi
27
+ fi
28
+
29
+ echo "Starting MongoDB test container..."
30
+ docker run -d \
31
+ --name "${CONTAINER_NAME}" \
32
+ -p "${MONGODB_PORT}:27017" \
33
+ "${MONGODB_IMAGE}"
34
+
35
+ if [ $? -ne 0 ]; then
36
+ echo "ERROR: Failed to start MongoDB container."
37
+ exit 1
38
+ fi
39
+
40
+ echo "Waiting for MongoDB to be ready..."
41
+ RETRIES=30
42
+ until docker exec "${CONTAINER_NAME}" mongosh --eval "db.adminCommand('ping')" > /dev/null 2>&1; do
43
+ RETRIES=$((RETRIES - 1))
44
+ if [ $RETRIES -le 0 ]; then
45
+ echo "ERROR: MongoDB failed to become ready in time."
46
+ docker logs "${CONTAINER_NAME}" 2>&1 | tail -20
47
+ exit 1
48
+ fi
49
+ echo " ...waiting (${RETRIES} retries left)"
50
+ sleep 2
51
+ done
52
+
53
+ echo ""
54
+ echo "MongoDB test database is ready!"
55
+ echo " Container: ${CONTAINER_NAME}"
56
+ echo " Host: 127.0.0.1:${MONGODB_PORT}"
57
+ echo " Database: meadow_test"
58
+ echo ""
59
+ echo "Run tests with: npm run test-mongodb"
60
+ }
61
+
62
+ stop_mongodb() {
63
+ if docker ps -a --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
64
+ echo "Stopping and removing MongoDB test container..."
65
+ docker stop "${CONTAINER_NAME}" > /dev/null 2>&1
66
+ docker rm "${CONTAINER_NAME}" > /dev/null 2>&1
67
+ echo "MongoDB test container removed."
68
+ else
69
+ echo "No MongoDB test container found."
70
+ fi
71
+ }
72
+
73
+ status_mongodb() {
74
+ if docker ps --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
75
+ echo "MongoDB test container is running."
76
+ docker ps --filter "name=${CONTAINER_NAME}" --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
77
+ elif docker ps -a --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
78
+ echo "MongoDB test container exists but is stopped."
79
+ else
80
+ echo "MongoDB test container is not running."
81
+ fi
82
+ }
83
+
84
+ case "${1}" in
85
+ start)
86
+ start_mongodb
87
+ ;;
88
+ stop)
89
+ stop_mongodb
90
+ ;;
91
+ status)
92
+ status_mongodb
93
+ ;;
94
+ *)
95
+ echo "Usage: $0 {start|stop|status}"
96
+ exit 1
97
+ ;;
98
+ esac
@@ -0,0 +1,124 @@
1
+ #!/bin/bash
2
+ # PostgreSQL Test Database Management Script
3
+ #
4
+ # Usage:
5
+ # ./scripts/postgresql-test-db.sh start - Start PostgreSQL container, load schema and seed data
6
+ # ./scripts/postgresql-test-db.sh stop - Stop and remove the container
7
+ # ./scripts/postgresql-test-db.sh status - Check if the container is running
8
+ #
9
+ # The container settings match the test configuration in
10
+ # test/Meadow-Provider-PostgreSQL_tests.js and meadow-connection-postgresql:
11
+ # Host: 127.0.0.1, Port: 35432, User: postgres
12
+ # Password: testpassword, Database: bookstore
13
+
14
+ CONTAINER_NAME="meadow-postgresql-test"
15
+ POSTGRES_USER="postgres"
16
+ POSTGRES_PASSWORD="testpassword"
17
+ POSTGRES_DATABASE="bookstore"
18
+ POSTGRES_PORT="35432"
19
+ POSTGRES_IMAGE="postgres:16"
20
+
21
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
22
+ SEED_SQL="${SCRIPT_DIR}/bookstore-seed-postgresql.sql"
23
+
24
+ start_postgresql() {
25
+ # Check if container already exists
26
+ if docker ps -a --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
27
+ if docker ps --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
28
+ echo "PostgreSQL test container is already running."
29
+ return 0
30
+ else
31
+ echo "Removing stopped container..."
32
+ docker rm "${CONTAINER_NAME}" > /dev/null 2>&1
33
+ fi
34
+ fi
35
+
36
+ echo "Starting PostgreSQL test container..."
37
+ docker run -d \
38
+ --name "${CONTAINER_NAME}" \
39
+ -e POSTGRES_USER="${POSTGRES_USER}" \
40
+ -e POSTGRES_PASSWORD="${POSTGRES_PASSWORD}" \
41
+ -e POSTGRES_DB="${POSTGRES_DATABASE}" \
42
+ -p "${POSTGRES_PORT}:5432" \
43
+ "${POSTGRES_IMAGE}"
44
+
45
+ if [ $? -ne 0 ]; then
46
+ echo "ERROR: Failed to start PostgreSQL container."
47
+ exit 1
48
+ fi
49
+
50
+ echo "Waiting for PostgreSQL to be ready..."
51
+ RETRIES=30
52
+ until docker exec "${CONTAINER_NAME}" pg_isready -U "${POSTGRES_USER}" 2>/dev/null; do
53
+ RETRIES=$((RETRIES - 1))
54
+ if [ $RETRIES -le 0 ]; then
55
+ echo "ERROR: PostgreSQL failed to become ready in time."
56
+ docker logs "${CONTAINER_NAME}" 2>&1 | tail -20
57
+ exit 1
58
+ fi
59
+ echo " ...waiting (${RETRIES} retries left)"
60
+ sleep 2
61
+ done
62
+
63
+ # Load bookstore schema and seed data
64
+ if [ -f "${SEED_SQL}" ]; then
65
+ echo "Loading bookstore schema and seed data..."
66
+ docker cp "${SEED_SQL}" "${CONTAINER_NAME}:/tmp/bookstore-seed.sql"
67
+ docker exec "${CONTAINER_NAME}" psql -U "${POSTGRES_USER}" -d "${POSTGRES_DATABASE}" -f /tmp/bookstore-seed.sql
68
+ if [ $? -ne 0 ]; then
69
+ echo "WARNING: Failed to load seed data. Tests requiring pre-populated data may fail."
70
+ else
71
+ echo "Bookstore schema and seed data loaded successfully."
72
+ fi
73
+ else
74
+ echo "WARNING: Seed file not found at ${SEED_SQL}. Skipping schema/data loading."
75
+ fi
76
+
77
+ echo ""
78
+ echo "PostgreSQL test database is ready!"
79
+ echo " Container: ${CONTAINER_NAME}"
80
+ echo " Host: 127.0.0.1:${POSTGRES_PORT}"
81
+ echo " User: ${POSTGRES_USER}"
82
+ echo " Password: ${POSTGRES_PASSWORD}"
83
+ echo " Database: ${POSTGRES_DATABASE}"
84
+ echo ""
85
+ echo "Run tests with: npm test"
86
+ }
87
+
88
+ stop_postgresql() {
89
+ if docker ps -a --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
90
+ echo "Stopping and removing PostgreSQL test container..."
91
+ docker stop "${CONTAINER_NAME}" > /dev/null 2>&1
92
+ docker rm "${CONTAINER_NAME}" > /dev/null 2>&1
93
+ echo "PostgreSQL test container removed."
94
+ else
95
+ echo "No PostgreSQL test container found."
96
+ fi
97
+ }
98
+
99
+ status_postgresql() {
100
+ if docker ps --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
101
+ echo "PostgreSQL test container is running."
102
+ docker ps --filter "name=${CONTAINER_NAME}" --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
103
+ elif docker ps -a --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
104
+ echo "PostgreSQL test container exists but is stopped."
105
+ else
106
+ echo "PostgreSQL test container is not running."
107
+ fi
108
+ }
109
+
110
+ case "${1}" in
111
+ start)
112
+ start_postgresql
113
+ ;;
114
+ stop)
115
+ stop_postgresql
116
+ ;;
117
+ status)
118
+ status_postgresql
119
+ ;;
120
+ *)
121
+ echo "Usage: $0 {start|stop|status}"
122
+ exit 1
123
+ ;;
124
+ esac
@@ -0,0 +1,135 @@
1
+ #!/bin/bash
2
+ # Solr Test Database Management Script
3
+ #
4
+ # Usage:
5
+ # ./scripts/solr-test-db.sh start - Start Solr container, create core, and wait for readiness
6
+ # ./scripts/solr-test-db.sh stop - Stop and remove the container
7
+ # ./scripts/solr-test-db.sh status - Check if the container is running
8
+ #
9
+ # The container settings match the test configuration in
10
+ # test/Meadow-Provider-Solr_tests.js:
11
+ # Host: 127.0.0.1, Port: 38983, Core: meadow_test
12
+
13
+ CONTAINER_NAME="meadow-solr-test"
14
+ SOLR_PORT="38983"
15
+ SOLR_CORE="meadow_test"
16
+ SOLR_IMAGE="solr:9"
17
+
18
+ start_solr() {
19
+ # Check if container already exists
20
+ if docker ps -a --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
21
+ if docker ps --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
22
+ echo "Solr test container is already running."
23
+ return 0
24
+ else
25
+ echo "Removing stopped container..."
26
+ docker rm "${CONTAINER_NAME}" > /dev/null 2>&1
27
+ fi
28
+ fi
29
+
30
+ echo "Starting Solr test container..."
31
+ docker run -d \
32
+ --name "${CONTAINER_NAME}" \
33
+ -p "${SOLR_PORT}:8983" \
34
+ "${SOLR_IMAGE}"
35
+
36
+ if [ $? -ne 0 ]; then
37
+ echo "ERROR: Failed to start Solr container."
38
+ exit 1
39
+ fi
40
+
41
+ echo "Waiting for Solr to be ready..."
42
+ RETRIES=30
43
+ until curl -sf "http://localhost:${SOLR_PORT}/solr/admin/info/system" > /dev/null 2>&1; do
44
+ RETRIES=$((RETRIES - 1))
45
+ if [ $RETRIES -le 0 ]; then
46
+ echo "ERROR: Solr failed to become ready in time."
47
+ docker logs "${CONTAINER_NAME}" 2>&1 | tail -20
48
+ exit 1
49
+ fi
50
+ echo " ...waiting (${RETRIES} retries left)"
51
+ sleep 2
52
+ done
53
+
54
+ # Create the test core
55
+ echo "Creating Solr core '${SOLR_CORE}'..."
56
+ docker exec "${CONTAINER_NAME}" solr create_core -c "${SOLR_CORE}" > /dev/null 2>&1
57
+ if [ $? -ne 0 ]; then
58
+ # Core might already exist, check if it's accessible
59
+ if curl -sf "http://localhost:${SOLR_PORT}/solr/${SOLR_CORE}/admin/ping" > /dev/null 2>&1; then
60
+ echo "Solr core '${SOLR_CORE}' already exists."
61
+ else
62
+ echo "WARNING: Failed to create Solr core '${SOLR_CORE}'."
63
+ fi
64
+ else
65
+ echo "Solr core '${SOLR_CORE}' created successfully."
66
+ fi
67
+
68
+ # Define schema fields as single-valued types for proper sorting and filtering
69
+ echo "Configuring Solr schema..."
70
+ curl -sf -X POST "http://localhost:${SOLR_PORT}/solr/${SOLR_CORE}/schema" \
71
+ -H 'Content-type: application/json' \
72
+ -d '{
73
+ "add-field": [
74
+ {"name": "IDAnimal", "type": "plong", "stored": true, "indexed": true, "multiValued": false},
75
+ {"name": "GUIDAnimal", "type": "string", "stored": true, "indexed": true, "multiValued": false},
76
+ {"name": "CreateDate", "type": "pdate", "stored": true, "indexed": true, "multiValued": false},
77
+ {"name": "CreatingIDUser", "type": "plong", "stored": true, "indexed": true, "multiValued": false},
78
+ {"name": "UpdateDate", "type": "pdate", "stored": true, "indexed": true, "multiValued": false},
79
+ {"name": "UpdatingIDUser", "type": "plong", "stored": true, "indexed": true, "multiValued": false},
80
+ {"name": "Deleted", "type": "plong", "stored": true, "indexed": true, "multiValued": false},
81
+ {"name": "DeletingIDUser", "type": "plong", "stored": true, "indexed": true, "multiValued": false},
82
+ {"name": "DeleteDate", "type": "string", "stored": true, "indexed": true, "multiValued": false},
83
+ {"name": "Name", "type": "string", "stored": true, "indexed": true, "multiValued": false},
84
+ {"name": "Type", "type": "string", "stored": true, "indexed": true, "multiValued": false},
85
+ {"name": "seq", "type": "plong", "stored": true, "indexed": true, "multiValued": false}
86
+ ]
87
+ }' > /dev/null 2>&1
88
+ echo "Solr schema configured."
89
+
90
+ echo ""
91
+ echo "Solr test instance is ready!"
92
+ echo " Container: ${CONTAINER_NAME}"
93
+ echo " Host: 127.0.0.1:${SOLR_PORT}"
94
+ echo " Core: ${SOLR_CORE}"
95
+ echo ""
96
+ echo "Run tests with: npm run test-solr"
97
+ }
98
+
99
+ stop_solr() {
100
+ if docker ps -a --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
101
+ echo "Stopping and removing Solr test container..."
102
+ docker stop "${CONTAINER_NAME}" > /dev/null 2>&1
103
+ docker rm "${CONTAINER_NAME}" > /dev/null 2>&1
104
+ echo "Solr test container removed."
105
+ else
106
+ echo "No Solr test container found."
107
+ fi
108
+ }
109
+
110
+ status_solr() {
111
+ if docker ps --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
112
+ echo "Solr test container is running."
113
+ docker ps --filter "name=${CONTAINER_NAME}" --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
114
+ elif docker ps -a --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
115
+ echo "Solr test container exists but is stopped."
116
+ else
117
+ echo "Solr test container is not running."
118
+ fi
119
+ }
120
+
121
+ case "${1}" in
122
+ start)
123
+ start_solr
124
+ ;;
125
+ stop)
126
+ stop_solr
127
+ ;;
128
+ status)
129
+ status_solr
130
+ ;;
131
+ *)
132
+ echo "Usage: $0 {start|stop|status}"
133
+ exit 1
134
+ ;;
135
+ esac
package/source/Meadow.js CHANGED
@@ -137,6 +137,11 @@ var Meadow = function()
137
137
  'MySQL': require(`./providers/Meadow-Provider-MySQL.js`),
138
138
  'MSSQL': require(`./providers/Meadow-Provider-MSSQL.js`),
139
139
  'SQLite': require(`./providers/Meadow-Provider-SQLite.js`),
140
+ 'PostgreSQL': require(`./providers/Meadow-Provider-PostgreSQL.js`),
141
+ 'MongoDB': require(`./providers/Meadow-Provider-MongoDB.js`),
142
+ 'DGraph': require(`./providers/Meadow-Provider-DGraph.js`),
143
+ 'Solr': require(`./providers/Meadow-Provider-Solr.js`),
144
+ 'RocksDB': require(`./providers/Meadow-Provider-RocksDB.js`),
140
145
  'None': require(`./providers/Meadow-Provider-None.js`),
141
146
  });
142
147
  var setProvider = function(pProviderName)