diff --git a/.babelrc.js b/.babelrc.js
new file mode 100644
index 00000000..a441c659
--- /dev/null
+++ b/.babelrc.js
@@ -0,0 +1,3 @@
+module.exports = {
+ presets: ['@babel/preset-env']
+};
\ No newline at end of file
diff --git a/.eslintrc.js b/.eslintrc.js
new file mode 100644
index 00000000..9381146e
--- /dev/null
+++ b/.eslintrc.js
@@ -0,0 +1,43 @@
+module.exports = {
+ env: {
+ "es2020": true,
+ "node": true,
+ "browser": true,
+ "jest": true
+ },
+ extends: 'standard',
+ // "globals": {
+ // "Atomics": "readonly",
+ // "SharedArrayBuffer": "readonly"
+ // },
+ // "parserOptions": {
+ // "ecmaFeatures": {
+ // "jsx": true
+ // },
+ // "ecmaVersion": 2015,
+ // "sourceType": "module"
+ // },
+ parser: "@babel/eslint-parser", // Use Babel parser to handle modern JS syntax
+ plugins: [
+ 'standard',
+ 'promise'
+ ],
+ rules: {
+ 'semi': ['error', 'always'],
+ 'semi-spacing': ['error', { before: false, after: true }],
+ 'camelcase': 'off',
+ 'no-tabs': 'off',
+ 'eqeqeq': 'off',
+ 'no-unused-vars': 'warn',
+ 'no-undef': 'warn',
+ 'no-prototype-builtins': 'off',
+ 'no-extend-native': 'off',
+ 'no-fallthrough': 'off',
+ 'prefer-promise-reject-errors': 'off',
+ 'prefer-regex-literals': 'off',
+ 'no-useless-escape': 'off',
+ 'n/handle-callback-err': 'off',
+ 'n/no-callback-literal': 'off',
+ 'no-async-promise-executor': 'off'
+ }
+};
\ No newline at end of file
diff --git a/.github/workflows/link-check.yml b/.github/workflows/link-check.yml
new file mode 100644
index 00000000..7ec341fc
--- /dev/null
+++ b/.github/workflows/link-check.yml
@@ -0,0 +1,25 @@
+name: Lint Check on PR
+
+on:
+ pull_request:
+ types: [opened, synchronize, reopened]
+
+jobs:
+ lint:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout the repository
+ uses: actions/checkout@v4
+
+ - name: Set up Node.js
+ uses: actions/setup-node@v2
+ with:
+ node-version: '22.x'
+ registry-url: 'https://registry.npmjs.org'
+
+ - name: Install dependencies
+ run: npm install
+
+ - name: Run ESLint
+ run: npm run lint
\ No newline at end of file
diff --git a/.husky/pre-commit b/.husky/pre-commit
new file mode 100755
index 00000000..ede0c885
--- /dev/null
+++ b/.husky/pre-commit
@@ -0,0 +1,82 @@
+#!/usr/bin/env sh
+# Pre-commit hook to run lint, Snyk and Talisman scans, completing all before deciding to commit
+
+# Function to check if a command exists
+command_exists() {
+ command -v "$1" >/dev/null 2>&1
+}
+
+# Allow bypassing the hook with an environment variable
+if [ "$SKIP_HOOK" = "1" ]; then
+ echo "Skipping lint, Snyk and Talisman scans (SKIP_HOOK=1)."
+ exit 0
+fi
+
+# Run ESLint check first
+echo "Running ESLint check..."
+npm run lint
+lint_exit_code=$?
+
+if [ $lint_exit_code -ne 0 ]; then
+ echo "ESLint check failed. Please fix the linting issues and try again."
+ echo "You can run 'npm run format' to auto-fix most issues."
+ exit 1
+fi
+
+echo "ESLint check passed."
+
+# Check if Snyk is installed
+if ! command_exists snyk; then
+ echo "Error: Snyk is not installed. Please install it and try again."
+ exit 1
+fi
+
+# Check if Talisman is installed
+if ! command_exists talisman; then
+ echo "Error: Talisman is not installed. Please install it and try again."
+ exit 1
+fi
+
+# Initialize variables to track scan results
+snyk_failed=false
+talisman_failed=false
+
+# Run Snyk vulnerability scan
+echo "Running Snyk vulnerability scan..."
+snyk test --all-projects > snyk_output.log 2>&1
+snyk_exit_code=$?
+
+if [ $snyk_exit_code -eq 0 ]; then
+ echo "Snyk scan passed: No vulnerabilities found."
+elif [ $snyk_exit_code -eq 1 ]; then
+ echo "Snyk found vulnerabilities. See snyk_output.log for details."
+ snyk_failed=true
+else
+ echo "Snyk scan failed with error (exit code $snyk_exit_code). See snyk_output.log for details."
+ snyk_failed=true
+fi
+
+# Run Talisman secret scan (continues even if Snyk failed)
+echo "Running Talisman secret scan..."
+talisman --githook pre-commit > talisman_output.log 2>&1
+talisman_exit_code=$?
+
+if [ $talisman_exit_code -eq 0 ]; then
+ echo "Talisman scan passed: No secrets found."
+else
+ echo "Talisman scan failed (exit code $talisman_exit_code). See talisman_output.log for details."
+ talisman_failed=true
+fi
+
+# Evaluate results after both scans
+if [ "$snyk_failed" = true ] || [ "$talisman_failed" = true ]; then
+ echo "Commit aborted due to issues found in one or both scans."
+ [ "$snyk_failed" = true ] && echo "- Snyk issues: Check snyk_output.log"
+ [ "$talisman_failed" = true ] && echo "- Talisman issues: Check talisman_output.log"
+ exit 1
+fi
+
+# If all checks pass, allow the commit
+echo "All checks passed (ESLint, Snyk, Talisman). Proceeding with commit."
+rm -f snyk_output.log talisman_output.log
+exit 0
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 8926e56c..abf90bb5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,26 +1,34 @@
{
"name": "contentstack",
- "version": "3.26.1",
+ "version": "3.26.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "contentstack",
- "version": "3.26.1",
+ "version": "3.26.2",
"license": "MIT",
"dependencies": {
"@contentstack/utils": "^1.4.1",
"es6-promise": "^4.2.8",
+ "husky": "^9.1.7",
"localStorage": "1.0.4"
},
"devDependencies": {
"@babel/core": "^7.28.0",
+ "@babel/eslint-parser": "^7.28.0",
"@babel/preset-env": "^7.28.0",
"@slack/bolt": "^4.4.0",
"@types/jest": "^30.0.0",
"babel-loader": "^10.0.0",
"clean-webpack-plugin": "^4.0.0",
- "dotenv": "^17.2.0",
+ "dotenv": "^17.2.1",
+ "eslint": "^8.57.1",
+ "eslint-config-standard": "^17.1.0",
+ "eslint-plugin-import": "^2.32.0",
+ "eslint-plugin-node": "^11.1.0",
+ "eslint-plugin-promise": "^6.6.0",
+ "eslint-plugin-standard": "^4.1.0",
"jest": "^30.0.5",
"jest-html-reporters": "^3.1.7",
"jsdoc": "^4.0.4",
@@ -32,7 +40,7 @@
"tap-json": "1.0.0",
"ts-jest": "^29.4.0",
"typescript": "^5.8.3",
- "webpack": "^5.100.2",
+ "webpack": "^5.101.0",
"webpack-cli": "^6.0.1",
"webpack-merge": "6.0.1",
"webpack-node-externals": "^3.0.0"
@@ -132,6 +140,35 @@
"url": "https://opencollective.com/babel"
}
},
+ "node_modules/@babel/eslint-parser": {
+ "version": "7.28.0",
+ "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.28.0.tgz",
+ "integrity": "sha512-N4ntErOlKvcbTt01rr5wj3y55xnIdx1ymrfIr8C2WnM1Y9glFgWaGDEULJIazOX3XM9NRzhfJ6zZnQ1sBNWU+w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@nicolo-ribaudo/eslint-scope-5-internals": "5.1.1-v1",
+ "eslint-visitor-keys": "^2.1.0",
+ "semver": "^6.3.1"
+ },
+ "engines": {
+ "node": "^10.13.0 || ^12.13.0 || >=14.0.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.11.0",
+ "eslint": "^7.5.0 || ^8.0.0 || ^9.0.0"
+ }
+ },
+ "node_modules/@babel/eslint-parser/node_modules/eslint-visitor-keys": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz",
+ "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=10"
+ }
+ },
"node_modules/@babel/generator": {
"version": "7.28.0",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.28.0.tgz",
@@ -1951,6 +1988,151 @@
"node": ">=14.17.0"
}
},
+ "node_modules/@eslint-community/eslint-utils": {
+ "version": "4.7.0",
+ "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz",
+ "integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "eslint-visitor-keys": "^3.4.3"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0"
+ }
+ },
+ "node_modules/@eslint-community/regexpp": {
+ "version": "4.12.1",
+ "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz",
+ "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^12.0.0 || ^14.0.0 || >=16.0.0"
+ }
+ },
+ "node_modules/@eslint/eslintrc": {
+ "version": "2.1.4",
+ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz",
+ "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ajv": "^6.12.4",
+ "debug": "^4.3.2",
+ "espree": "^9.6.0",
+ "globals": "^13.19.0",
+ "ignore": "^5.2.0",
+ "import-fresh": "^3.2.1",
+ "js-yaml": "^4.1.0",
+ "minimatch": "^3.1.2",
+ "strip-json-comments": "^3.1.1"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/@eslint/eslintrc/node_modules/ajv": {
+ "version": "6.12.6",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
+ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "fast-deep-equal": "^3.1.1",
+ "fast-json-stable-stringify": "^2.0.0",
+ "json-schema-traverse": "^0.4.1",
+ "uri-js": "^4.2.2"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/epoberezkin"
+ }
+ },
+ "node_modules/@eslint/eslintrc/node_modules/argparse": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
+ "dev": true,
+ "license": "Python-2.0"
+ },
+ "node_modules/@eslint/eslintrc/node_modules/js-yaml": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
+ "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "argparse": "^2.0.1"
+ },
+ "bin": {
+ "js-yaml": "bin/js-yaml.js"
+ }
+ },
+ "node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@eslint/js": {
+ "version": "8.57.1",
+ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz",
+ "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ }
+ },
+ "node_modules/@humanwhocodes/config-array": {
+ "version": "0.13.0",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz",
+ "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==",
+ "deprecated": "Use @eslint/config-array instead",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@humanwhocodes/object-schema": "^2.0.3",
+ "debug": "^4.3.1",
+ "minimatch": "^3.0.5"
+ },
+ "engines": {
+ "node": ">=10.10.0"
+ }
+ },
+ "node_modules/@humanwhocodes/module-importer": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz",
+ "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=12.22"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/nzakas"
+ }
+ },
+ "node_modules/@humanwhocodes/object-schema": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz",
+ "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==",
+ "deprecated": "Use @eslint/object-schema instead",
+ "dev": true,
+ "license": "BSD-3-Clause"
+ },
"node_modules/@isaacs/cliui": {
"version": "8.0.2",
"resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
@@ -2549,6 +2731,54 @@
"node": ">=v12.0.0"
}
},
+ "node_modules/@nicolo-ribaudo/eslint-scope-5-internals": {
+ "version": "5.1.1-v1",
+ "resolved": "https://registry.npmjs.org/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz",
+ "integrity": "sha512-54/JRvkLIzzDWshCWfuhadfrfZVPiElY8Fcgmg1HroEly/EDSszzhBAsarCux+D/kOslTRquNzuyGSmUSTTHGg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "eslint-scope": "5.1.1"
+ }
+ },
+ "node_modules/@nodelib/fs.scandir": {
+ "version": "2.1.5",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
+ "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@nodelib/fs.stat": "2.0.5",
+ "run-parallel": "^1.1.9"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/@nodelib/fs.stat": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",
+ "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/@nodelib/fs.walk": {
+ "version": "1.2.8",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz",
+ "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@nodelib/fs.scandir": "2.1.5",
+ "fastq": "^1.6.0"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
"node_modules/@open-draft/until": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@open-draft/until/-/until-1.0.3.tgz",
@@ -2580,6 +2810,13 @@
"url": "https://opencollective.com/pkgr"
}
},
+ "node_modules/@rtsao/scc": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz",
+ "integrity": "sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@sinclair/typebox": {
"version": "0.34.38",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.34.38.tgz",
@@ -2909,6 +3146,13 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/@types/json5": {
+ "version": "0.0.29",
+ "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
+ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@types/jsonwebtoken": {
"version": "9.0.10",
"resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.10.tgz",
@@ -3316,6 +3560,29 @@
"node": ">= 0.6"
}
},
+ "node_modules/acorn": {
+ "version": "8.15.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
+ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "acorn": "bin/acorn"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/acorn-jsx": {
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
+ "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
+ "dev": true,
+ "license": "MIT",
+ "peerDependencies": {
+ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
+ }
+ },
"node_modules/agent-base": {
"version": "7.1.4",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz",
@@ -3440,6 +3707,46 @@
"sprintf-js": "~1.0.2"
}
},
+ "node_modules/array-buffer-byte-length": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz",
+ "integrity": "sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.3",
+ "is-array-buffer": "^3.0.5"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/array-includes": {
+ "version": "3.1.9",
+ "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.9.tgz",
+ "integrity": "sha512-FmeCCAenzH0KH381SPT5FZmiA/TmpndpcaShhfgEN9eCVjnFBqq3l1xrI42y8+PPLI6hypzou4GXw00WHmPBLQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bind": "^1.0.8",
+ "call-bound": "^1.0.4",
+ "define-properties": "^1.2.1",
+ "es-abstract": "^1.24.0",
+ "es-object-atoms": "^1.1.1",
+ "get-intrinsic": "^1.3.0",
+ "is-string": "^1.1.1",
+ "math-intrinsics": "^1.1.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/array-union": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz",
@@ -3463,6 +3770,88 @@
"node": ">=0.10.0"
}
},
+ "node_modules/array.prototype.findlastindex": {
+ "version": "1.2.6",
+ "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.6.tgz",
+ "integrity": "sha512-F/TKATkzseUExPlfvmwQKGITM3DGTK+vkAsCZoDc5daVygbJBnjEUCbgkAvVFsgfXfX4YIqZ/27G3k3tdXrTxQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bind": "^1.0.8",
+ "call-bound": "^1.0.4",
+ "define-properties": "^1.2.1",
+ "es-abstract": "^1.23.9",
+ "es-errors": "^1.3.0",
+ "es-object-atoms": "^1.1.1",
+ "es-shim-unscopables": "^1.1.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/array.prototype.flat": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.3.tgz",
+ "integrity": "sha512-rwG/ja1neyLqCuGZ5YYrznA62D4mZXg0i1cIskIUKSiqF3Cje9/wXAls9B9s1Wa2fomMsIv8czB8jZcPmxCXFg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bind": "^1.0.8",
+ "define-properties": "^1.2.1",
+ "es-abstract": "^1.23.5",
+ "es-shim-unscopables": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/array.prototype.flatmap": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.3.tgz",
+ "integrity": "sha512-Y7Wt51eKJSyi80hFrJCePGGNo5ktJCslFuboqJsbf57CCPcm5zztluPlc4/aD8sWsKvlwatezpV4U1efk8kpjg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bind": "^1.0.8",
+ "define-properties": "^1.2.1",
+ "es-abstract": "^1.23.5",
+ "es-shim-unscopables": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/arraybuffer.prototype.slice": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz",
+ "integrity": "sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "array-buffer-byte-length": "^1.0.1",
+ "call-bind": "^1.0.8",
+ "define-properties": "^1.2.1",
+ "es-abstract": "^1.23.5",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.6",
+ "is-array-buffer": "^3.0.4"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/async": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz",
@@ -3470,6 +3859,16 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/async-function": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/async-function/-/async-function-1.0.0.tgz",
+ "integrity": "sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
@@ -3477,6 +3876,22 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/available-typed-arrays": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz",
+ "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "possible-typed-array-names": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/axios": {
"version": "1.11.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.11.0.tgz",
@@ -3824,16 +4239,74 @@
"dev": true,
"license": "MIT"
},
- "node_modules/bytes": {
- "version": "3.1.2",
- "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
- "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
+ "node_modules/builtin-modules": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz",
+ "integrity": "sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==",
"dev": true,
"license": "MIT",
+ "peer": true,
"engines": {
- "node": ">= 0.8"
- }
- },
+ "node": ">=6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/builtins": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.1.0.tgz",
+ "integrity": "sha512-SW9lzGTLvWTP1AY8xeAMZimqDrIaSdLQUcVr9DMef51niJ022Ri87SwRRKYm4A6iHfkPaiVUu/Duw2Wc4J7kKg==",
+ "dev": true,
+ "license": "MIT",
+ "peer": true,
+ "dependencies": {
+ "semver": "^7.0.0"
+ }
+ },
+ "node_modules/builtins/node_modules/semver": {
+ "version": "7.7.2",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz",
+ "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==",
+ "dev": true,
+ "license": "ISC",
+ "peer": true,
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/bytes": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
+ "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/call-bind": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz",
+ "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.0",
+ "es-define-property": "^1.0.0",
+ "get-intrinsic": "^1.2.4",
+ "set-function-length": "^1.2.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/call-bind-apply-helpers": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
@@ -4195,6 +4668,60 @@
"node": ">=18"
}
},
+ "node_modules/data-view-buffer": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz",
+ "integrity": "sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.3",
+ "es-errors": "^1.3.0",
+ "is-data-view": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/data-view-byte-length": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz",
+ "integrity": "sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.3",
+ "es-errors": "^1.3.0",
+ "is-data-view": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/inspect-js"
+ }
+ },
+ "node_modules/data-view-byte-offset": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz",
+ "integrity": "sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "es-errors": "^1.3.0",
+ "is-data-view": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/debug": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz",
@@ -4235,6 +4762,13 @@
}
}
},
+ "node_modules/deep-is": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
+ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/deepmerge": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz",
@@ -4245,6 +4779,24 @@
"node": ">=0.10.0"
}
},
+ "node_modules/define-data-property": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",
+ "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "es-define-property": "^1.0.0",
+ "es-errors": "^1.3.0",
+ "gopd": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/define-lazy-prop": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz",
@@ -4255,6 +4807,24 @@
"node": ">=8"
}
},
+ "node_modules/define-properties": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz",
+ "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "define-data-property": "^1.0.1",
+ "has-property-descriptors": "^1.0.0",
+ "object-keys": "^1.1.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/del": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/del/-/del-4.1.1.tgz",
@@ -4304,10 +4874,23 @@
"node": ">=8"
}
},
+ "node_modules/doctrine": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
+ "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "esutils": "^2.0.2"
+ },
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
"node_modules/dotenv": {
- "version": "17.2.0",
- "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.0.tgz",
- "integrity": "sha512-Q4sgBT60gzd0BB0lSyYD3xM4YxrXA9y4uBDof1JNYGzOXrQdQ6yX+7XIAqoFOGQFOTK1D3Hts5OllpxMDZFONQ==",
+ "version": "17.2.1",
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.1.tgz",
+ "integrity": "sha512-kQhDYKZecqnM0fCnzI5eIv5L4cAe/iRI+HqMbO/hbRdTAeXDG+M9FjipUxNfbARuEg4iHIbhnhs78BCHNbSxEQ==",
"dev": true,
"license": "BSD-2-Clause",
"engines": {
@@ -4453,6 +5036,75 @@
"is-arrayish": "^0.2.1"
}
},
+ "node_modules/es-abstract": {
+ "version": "1.24.0",
+ "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.24.0.tgz",
+ "integrity": "sha512-WSzPgsdLtTcQwm4CROfS5ju2Wa1QQcVeT37jFjYzdFz1r9ahadC8B8/a4qxJxM+09F18iumCdRmlr96ZYkQvEg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "array-buffer-byte-length": "^1.0.2",
+ "arraybuffer.prototype.slice": "^1.0.4",
+ "available-typed-arrays": "^1.0.7",
+ "call-bind": "^1.0.8",
+ "call-bound": "^1.0.4",
+ "data-view-buffer": "^1.0.2",
+ "data-view-byte-length": "^1.0.2",
+ "data-view-byte-offset": "^1.0.1",
+ "es-define-property": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "es-object-atoms": "^1.1.1",
+ "es-set-tostringtag": "^2.1.0",
+ "es-to-primitive": "^1.3.0",
+ "function.prototype.name": "^1.1.8",
+ "get-intrinsic": "^1.3.0",
+ "get-proto": "^1.0.1",
+ "get-symbol-description": "^1.1.0",
+ "globalthis": "^1.0.4",
+ "gopd": "^1.2.0",
+ "has-property-descriptors": "^1.0.2",
+ "has-proto": "^1.2.0",
+ "has-symbols": "^1.1.0",
+ "hasown": "^2.0.2",
+ "internal-slot": "^1.1.0",
+ "is-array-buffer": "^3.0.5",
+ "is-callable": "^1.2.7",
+ "is-data-view": "^1.0.2",
+ "is-negative-zero": "^2.0.3",
+ "is-regex": "^1.2.1",
+ "is-set": "^2.0.3",
+ "is-shared-array-buffer": "^1.0.4",
+ "is-string": "^1.1.1",
+ "is-typed-array": "^1.1.15",
+ "is-weakref": "^1.1.1",
+ "math-intrinsics": "^1.1.0",
+ "object-inspect": "^1.13.4",
+ "object-keys": "^1.1.1",
+ "object.assign": "^4.1.7",
+ "own-keys": "^1.0.1",
+ "regexp.prototype.flags": "^1.5.4",
+ "safe-array-concat": "^1.1.3",
+ "safe-push-apply": "^1.0.0",
+ "safe-regex-test": "^1.1.0",
+ "set-proto": "^1.0.0",
+ "stop-iteration-iterator": "^1.1.0",
+ "string.prototype.trim": "^1.2.10",
+ "string.prototype.trimend": "^1.0.9",
+ "string.prototype.trimstart": "^1.0.8",
+ "typed-array-buffer": "^1.0.3",
+ "typed-array-byte-length": "^1.0.3",
+ "typed-array-byte-offset": "^1.0.4",
+ "typed-array-length": "^1.0.7",
+ "unbox-primitive": "^1.1.0",
+ "which-typed-array": "^1.1.19"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/es-define-property": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
@@ -4509,6 +5161,37 @@
"node": ">= 0.4"
}
},
+ "node_modules/es-shim-unscopables": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.1.0.tgz",
+ "integrity": "sha512-d9T8ucsEhh8Bi1woXCf+TIKDIROLG5WCkxg8geBCbvk22kzwC5G2OnXVMO6FUsvQlgUUXQ2itephWDLqDzbeCw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "hasown": "^2.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-to-primitive": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.3.0.tgz",
+ "integrity": "sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-callable": "^1.2.7",
+ "is-date-object": "^1.0.5",
+ "is-symbol": "^1.0.4"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/es6-promise": {
"version": "4.2.8",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz",
@@ -4542,77 +5225,673 @@
"node": ">=8"
}
},
- "node_modules/eslint-scope": {
- "version": "5.1.1",
- "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
- "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==",
- "dev": true,
- "license": "BSD-2-Clause",
- "dependencies": {
- "esrecurse": "^4.3.0",
- "estraverse": "^4.1.1"
+ "node_modules/eslint": {
+ "version": "8.57.1",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz",
+ "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==",
+ "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@eslint-community/eslint-utils": "^4.2.0",
+ "@eslint-community/regexpp": "^4.6.1",
+ "@eslint/eslintrc": "^2.1.4",
+ "@eslint/js": "8.57.1",
+ "@humanwhocodes/config-array": "^0.13.0",
+ "@humanwhocodes/module-importer": "^1.0.1",
+ "@nodelib/fs.walk": "^1.2.8",
+ "@ungap/structured-clone": "^1.2.0",
+ "ajv": "^6.12.4",
+ "chalk": "^4.0.0",
+ "cross-spawn": "^7.0.2",
+ "debug": "^4.3.2",
+ "doctrine": "^3.0.0",
+ "escape-string-regexp": "^4.0.0",
+ "eslint-scope": "^7.2.2",
+ "eslint-visitor-keys": "^3.4.3",
+ "espree": "^9.6.1",
+ "esquery": "^1.4.2",
+ "esutils": "^2.0.2",
+ "fast-deep-equal": "^3.1.3",
+ "file-entry-cache": "^6.0.1",
+ "find-up": "^5.0.0",
+ "glob-parent": "^6.0.2",
+ "globals": "^13.19.0",
+ "graphemer": "^1.4.0",
+ "ignore": "^5.2.0",
+ "imurmurhash": "^0.1.4",
+ "is-glob": "^4.0.0",
+ "is-path-inside": "^3.0.3",
+ "js-yaml": "^4.1.0",
+ "json-stable-stringify-without-jsonify": "^1.0.1",
+ "levn": "^0.4.1",
+ "lodash.merge": "^4.6.2",
+ "minimatch": "^3.1.2",
+ "natural-compare": "^1.4.0",
+ "optionator": "^0.9.3",
+ "strip-ansi": "^6.0.1",
+ "text-table": "^0.2.0"
+ },
+ "bin": {
+ "eslint": "bin/eslint.js"
},
"engines": {
- "node": ">=8.0.0"
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
}
},
- "node_modules/esrecurse": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
- "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
+ "node_modules/eslint-compat-utils": {
+ "version": "0.5.1",
+ "resolved": "https://registry.npmjs.org/eslint-compat-utils/-/eslint-compat-utils-0.5.1.tgz",
+ "integrity": "sha512-3z3vFexKIEnjHE3zCMRo6fn/e44U7T1khUjg+Hp0ZQMCigh28rALD0nPFBcGZuiLC5rLZa2ubQHDRln09JfU2Q==",
"dev": true,
- "license": "BSD-2-Clause",
+ "license": "MIT",
+ "peer": true,
"dependencies": {
- "estraverse": "^5.2.0"
+ "semver": "^7.5.4"
},
"engines": {
- "node": ">=4.0"
+ "node": ">=12"
+ },
+ "peerDependencies": {
+ "eslint": ">=6.0.0"
}
},
- "node_modules/esrecurse/node_modules/estraverse": {
- "version": "5.3.0",
- "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
- "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
+ "node_modules/eslint-compat-utils/node_modules/semver": {
+ "version": "7.7.2",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz",
+ "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==",
"dev": true,
- "license": "BSD-2-Clause",
+ "license": "ISC",
+ "peer": true,
+ "bin": {
+ "semver": "bin/semver.js"
+ },
"engines": {
- "node": ">=4.0"
+ "node": ">=10"
}
},
- "node_modules/estraverse": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
- "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
+ "node_modules/eslint-config-standard": {
+ "version": "17.1.0",
+ "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-17.1.0.tgz",
+ "integrity": "sha512-IwHwmaBNtDK4zDHQukFDW5u/aTb8+meQWZvNFWkiGmbWjD6bqyuSSBxxXKkCftCUzc1zwCH2m/baCNDLGmuO5Q==",
"dev": true,
- "license": "BSD-2-Clause",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT",
"engines": {
- "node": ">=4.0"
+ "node": ">=12.0.0"
+ },
+ "peerDependencies": {
+ "eslint": "^8.0.1",
+ "eslint-plugin-import": "^2.25.2",
+ "eslint-plugin-n": "^15.0.0 || ^16.0.0 ",
+ "eslint-plugin-promise": "^6.0.0"
}
},
- "node_modules/esutils": {
- "version": "2.0.3",
- "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
- "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
+ "node_modules/eslint-import-resolver-node": {
+ "version": "0.3.9",
+ "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz",
+ "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==",
"dev": true,
- "license": "BSD-2-Clause",
- "engines": {
- "node": ">=0.10.0"
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^3.2.7",
+ "is-core-module": "^2.13.0",
+ "resolve": "^1.22.4"
}
},
- "node_modules/etag": {
- "version": "1.8.1",
- "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
- "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
+ "node_modules/eslint-import-resolver-node/node_modules/debug": {
+ "version": "3.2.7",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
+ "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
"license": "MIT",
- "engines": {
- "node": ">= 0.6"
+ "dependencies": {
+ "ms": "^2.1.1"
}
},
- "node_modules/eventemitter3": {
- "version": "5.0.1",
- "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz",
- "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==",
+ "node_modules/eslint-module-utils": {
+ "version": "2.12.1",
+ "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.12.1.tgz",
+ "integrity": "sha512-L8jSWTze7K2mTg0vos/RuLRS5soomksDPoJLXIslC7c8Wmut3bx7CPpJijDcBZtxQ5lrbUdM+s0OlNbz0DCDNw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^3.2.7"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "peerDependenciesMeta": {
+ "eslint": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/eslint-module-utils/node_modules/debug": {
+ "version": "3.2.7",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
+ "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.1"
+ }
+ },
+ "node_modules/eslint-plugin-es": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz",
+ "integrity": "sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "eslint-utils": "^2.0.0",
+ "regexpp": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8.10.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/mysticatea"
+ },
+ "peerDependencies": {
+ "eslint": ">=4.19.1"
+ }
+ },
+ "node_modules/eslint-plugin-es-x": {
+ "version": "7.8.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-es-x/-/eslint-plugin-es-x-7.8.0.tgz",
+ "integrity": "sha512-7Ds8+wAAoV3T+LAKeu39Y5BzXCrGKrcISfgKEqTS4BDN8SFEDQd0S43jiQ8vIa3wUKD07qitZdfzlenSi8/0qQ==",
+ "dev": true,
+ "funding": [
+ "https://github.com/sponsors/ota-meshi",
+ "https://opencollective.com/eslint"
+ ],
+ "license": "MIT",
+ "peer": true,
+ "dependencies": {
+ "@eslint-community/eslint-utils": "^4.1.2",
+ "@eslint-community/regexpp": "^4.11.0",
+ "eslint-compat-utils": "^0.5.1"
+ },
+ "engines": {
+ "node": "^14.18.0 || >=16.0.0"
+ },
+ "peerDependencies": {
+ "eslint": ">=8"
+ }
+ },
+ "node_modules/eslint-plugin-import": {
+ "version": "2.32.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.32.0.tgz",
+ "integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@rtsao/scc": "^1.1.0",
+ "array-includes": "^3.1.9",
+ "array.prototype.findlastindex": "^1.2.6",
+ "array.prototype.flat": "^1.3.3",
+ "array.prototype.flatmap": "^1.3.3",
+ "debug": "^3.2.7",
+ "doctrine": "^2.1.0",
+ "eslint-import-resolver-node": "^0.3.9",
+ "eslint-module-utils": "^2.12.1",
+ "hasown": "^2.0.2",
+ "is-core-module": "^2.16.1",
+ "is-glob": "^4.0.3",
+ "minimatch": "^3.1.2",
+ "object.fromentries": "^2.0.8",
+ "object.groupby": "^1.0.3",
+ "object.values": "^1.2.1",
+ "semver": "^6.3.1",
+ "string.prototype.trimend": "^1.0.9",
+ "tsconfig-paths": "^3.15.0"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "peerDependencies": {
+ "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9"
+ }
+ },
+ "node_modules/eslint-plugin-import/node_modules/debug": {
+ "version": "3.2.7",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
+ "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.1"
+ }
+ },
+ "node_modules/eslint-plugin-import/node_modules/doctrine": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
+ "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "esutils": "^2.0.2"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/eslint-plugin-n": {
+ "version": "16.6.2",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-16.6.2.tgz",
+ "integrity": "sha512-6TyDmZ1HXoFQXnhCTUjVFULReoBPOAjpuiKELMkeP40yffI/1ZRO+d9ug/VC6fqISo2WkuIBk3cvuRPALaWlOQ==",
+ "dev": true,
+ "license": "MIT",
+ "peer": true,
+ "dependencies": {
+ "@eslint-community/eslint-utils": "^4.4.0",
+ "builtins": "^5.0.1",
+ "eslint-plugin-es-x": "^7.5.0",
+ "get-tsconfig": "^4.7.0",
+ "globals": "^13.24.0",
+ "ignore": "^5.2.4",
+ "is-builtin-module": "^3.2.1",
+ "is-core-module": "^2.12.1",
+ "minimatch": "^3.1.2",
+ "resolve": "^1.22.2",
+ "semver": "^7.5.3"
+ },
+ "engines": {
+ "node": ">=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/mysticatea"
+ },
+ "peerDependencies": {
+ "eslint": ">=7.0.0"
+ }
+ },
+ "node_modules/eslint-plugin-n/node_modules/semver": {
+ "version": "7.7.2",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz",
+ "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==",
+ "dev": true,
+ "license": "ISC",
+ "peer": true,
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/eslint-plugin-node": {
+ "version": "11.1.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz",
+ "integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "eslint-plugin-es": "^3.0.0",
+ "eslint-utils": "^2.0.0",
+ "ignore": "^5.1.1",
+ "minimatch": "^3.0.4",
+ "resolve": "^1.10.1",
+ "semver": "^6.1.0"
+ },
+ "engines": {
+ "node": ">=8.10.0"
+ },
+ "peerDependencies": {
+ "eslint": ">=5.16.0"
+ }
+ },
+ "node_modules/eslint-plugin-promise": {
+ "version": "6.6.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.6.0.tgz",
+ "integrity": "sha512-57Zzfw8G6+Gq7axm2Pdo3gW/Rx3h9Yywgn61uE/3elTCOePEHVrn2i5CdfBwA1BLK0Q0WqctICIUSqXZW/VprQ==",
+ "dev": true,
+ "license": "ISC",
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^7.0.0 || ^8.0.0 || ^9.0.0"
+ }
+ },
+ "node_modules/eslint-plugin-standard": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-standard/-/eslint-plugin-standard-4.1.0.tgz",
+ "integrity": "sha512-ZL7+QRixjTR6/528YNGyDotyffm5OQst/sGxKDwGb9Uqs4In5Egi4+jbobhqJoyoCM6/7v/1A5fhQ7ScMtDjaQ==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT",
+ "peerDependencies": {
+ "eslint": ">=5.0.0"
+ }
+ },
+ "node_modules/eslint-scope": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
+ "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "esrecurse": "^4.3.0",
+ "estraverse": "^4.1.1"
+ },
+ "engines": {
+ "node": ">=8.0.0"
+ }
+ },
+ "node_modules/eslint-utils": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz",
+ "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "eslint-visitor-keys": "^1.1.0"
+ },
+ "engines": {
+ "node": ">=6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/mysticatea"
+ }
+ },
+ "node_modules/eslint-utils/node_modules/eslint-visitor-keys": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz",
+ "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/eslint-visitor-keys": {
+ "version": "3.4.3",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz",
+ "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/eslint/node_modules/ajv": {
+ "version": "6.12.6",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
+ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "fast-deep-equal": "^3.1.1",
+ "fast-json-stable-stringify": "^2.0.0",
+ "json-schema-traverse": "^0.4.1",
+ "uri-js": "^4.2.2"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/epoberezkin"
+ }
+ },
+ "node_modules/eslint/node_modules/argparse": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
+ "dev": true,
+ "license": "Python-2.0"
+ },
+ "node_modules/eslint/node_modules/escape-string-regexp": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
+ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/eslint/node_modules/eslint-scope": {
+ "version": "7.2.2",
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz",
+ "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "esrecurse": "^4.3.0",
+ "estraverse": "^5.2.0"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/eslint/node_modules/estraverse": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
+ "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=4.0"
+ }
+ },
+ "node_modules/eslint/node_modules/find-up": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
+ "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "locate-path": "^6.0.0",
+ "path-exists": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/eslint/node_modules/is-path-inside": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz",
+ "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/eslint/node_modules/js-yaml": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
+ "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "argparse": "^2.0.1"
+ },
+ "bin": {
+ "js-yaml": "bin/js-yaml.js"
+ }
+ },
+ "node_modules/eslint/node_modules/json-schema-traverse": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/eslint/node_modules/locate-path": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
+ "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "p-locate": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/eslint/node_modules/p-locate": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
+ "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "p-limit": "^3.0.2"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/espree": {
+ "version": "9.6.1",
+ "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz",
+ "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "acorn": "^8.9.0",
+ "acorn-jsx": "^5.3.2",
+ "eslint-visitor-keys": "^3.4.1"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/esquery": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz",
+ "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "estraverse": "^5.1.0"
+ },
+ "engines": {
+ "node": ">=0.10"
+ }
+ },
+ "node_modules/esquery/node_modules/estraverse": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
+ "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=4.0"
+ }
+ },
+ "node_modules/esrecurse": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
+ "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "estraverse": "^5.2.0"
+ },
+ "engines": {
+ "node": ">=4.0"
+ }
+ },
+ "node_modules/esrecurse/node_modules/estraverse": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
+ "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=4.0"
+ }
+ },
+ "node_modules/estraverse": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
+ "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=4.0"
+ }
+ },
+ "node_modules/esutils": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
+ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/etag": {
+ "version": "1.8.1",
+ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
+ "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/eventemitter3": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz",
+ "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==",
"dev": true,
"license": "MIT"
},
@@ -4745,6 +6024,13 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/fast-levenshtein": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
+ "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/fast-uri": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.6.tgz",
@@ -4772,6 +6058,16 @@
"node": ">= 4.9.1"
}
},
+ "node_modules/fastq": {
+ "version": "1.19.1",
+ "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz",
+ "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "reusify": "^1.0.4"
+ }
+ },
"node_modules/fb-watchman": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz",
@@ -4782,6 +6078,19 @@
"bser": "2.1.1"
}
},
+ "node_modules/file-entry-cache": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
+ "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "flat-cache": "^3.0.4"
+ },
+ "engines": {
+ "node": "^10.12.0 || >=12.0.0"
+ }
+ },
"node_modules/filelist": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz",
@@ -4870,6 +6179,45 @@
"flat": "cli.js"
}
},
+ "node_modules/flat-cache": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz",
+ "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "flatted": "^3.2.9",
+ "keyv": "^4.5.3",
+ "rimraf": "^3.0.2"
+ },
+ "engines": {
+ "node": "^10.12.0 || >=12.0.0"
+ }
+ },
+ "node_modules/flat-cache/node_modules/rimraf": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
+ "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
+ "deprecated": "Rimraf versions prior to v4 are no longer supported",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "glob": "^7.1.3"
+ },
+ "bin": {
+ "rimraf": "bin.js"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/flatted": {
+ "version": "3.3.3",
+ "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz",
+ "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==",
+ "dev": true,
+ "license": "ISC"
+ },
"node_modules/follow-redirects": {
"version": "1.15.9",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz",
@@ -4891,6 +6239,22 @@
}
}
},
+ "node_modules/for-each": {
+ "version": "0.3.5",
+ "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz",
+ "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-callable": "^1.2.7"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/foreground-child": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz",
@@ -5028,6 +6392,37 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/function.prototype.name": {
+ "version": "1.1.8",
+ "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.8.tgz",
+ "integrity": "sha512-e5iwyodOHhbMr/yNrc7fDYG4qlbIvI5gajyzPnb5TCwyhjApznQh1BMFou9b30SevY43gCJKXycoCBjMbsuW0Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bind": "^1.0.8",
+ "call-bound": "^1.0.3",
+ "define-properties": "^1.2.1",
+ "functions-have-names": "^1.2.3",
+ "hasown": "^2.0.2",
+ "is-callable": "^1.2.7"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/functions-have-names": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz",
+ "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==",
+ "dev": true,
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/gensync": {
"version": "1.0.0-beta.2",
"resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",
@@ -5110,6 +6505,38 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/get-symbol-description": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz",
+ "integrity": "sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.3",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.6"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/get-tsconfig": {
+ "version": "4.10.1",
+ "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.10.1.tgz",
+ "integrity": "sha512-auHyJ4AgMz7vgS8Hp3N6HXSmlMdUyhSUrfBF16w153rxtLIEOE+HGqaBppczZvnHLqQJfiHotCYpNhl0lUROFQ==",
+ "dev": true,
+ "license": "MIT",
+ "peer": true,
+ "dependencies": {
+ "resolve-pkg-maps": "^1.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1"
+ }
+ },
"node_modules/glob": {
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
@@ -5132,6 +6559,19 @@
"url": "https://github.com/sponsors/isaacs"
}
},
+ "node_modules/glob-parent": {
+ "version": "6.0.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
+ "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "is-glob": "^4.0.3"
+ },
+ "engines": {
+ "node": ">=10.13.0"
+ }
+ },
"node_modules/glob-to-regexp": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz",
@@ -5139,6 +6579,52 @@
"dev": true,
"license": "BSD-2-Clause"
},
+ "node_modules/globals": {
+ "version": "13.24.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz",
+ "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "type-fest": "^0.20.2"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/globals/node_modules/type-fest": {
+ "version": "0.20.2",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz",
+ "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==",
+ "dev": true,
+ "license": "(MIT OR CC0-1.0)",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/globalthis": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz",
+ "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "define-properties": "^1.2.1",
+ "gopd": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/globby": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz",
@@ -5186,6 +6672,26 @@
"dev": true,
"license": "ISC"
},
+ "node_modules/graphemer": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz",
+ "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/has-bigints": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.1.0.tgz",
+ "integrity": "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@@ -5196,6 +6702,35 @@
"node": ">=8"
}
},
+ "node_modules/has-property-descriptors": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
+ "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "es-define-property": "^1.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/has-proto": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.2.0.tgz",
+ "integrity": "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "dunder-proto": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/has-symbols": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
@@ -5330,6 +6865,21 @@
"node": ">=10.17.0"
}
},
+ "node_modules/husky": {
+ "version": "9.1.7",
+ "resolved": "https://registry.npmjs.org/husky/-/husky-9.1.7.tgz",
+ "integrity": "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==",
+ "license": "MIT",
+ "bin": {
+ "husky": "bin.js"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/typicode"
+ }
+ },
"node_modules/iconv-lite": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
@@ -5343,6 +6893,43 @@
"node": ">=0.10.0"
}
},
+ "node_modules/ignore": {
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
+ "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 4"
+ }
+ },
+ "node_modules/import-fresh": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz",
+ "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "parent-module": "^1.0.0",
+ "resolve-from": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/import-fresh/node_modules/resolve-from": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
+ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
"node_modules/import-local": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz",
@@ -5405,6 +6992,21 @@
"dev": true,
"license": "ISC"
},
+ "node_modules/internal-slot": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz",
+ "integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "hasown": "^2.0.2",
+ "side-channel": "^1.1.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/interpret": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz",
@@ -5425,6 +7027,24 @@
"node": ">= 0.10"
}
},
+ "node_modules/is-array-buffer": {
+ "version": "3.0.5",
+ "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz",
+ "integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bind": "^1.0.8",
+ "call-bound": "^1.0.3",
+ "get-intrinsic": "^1.2.6"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/is-arrayish": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
@@ -5432,14 +7052,220 @@
"dev": true,
"license": "MIT"
},
- "node_modules/is-core-module": {
- "version": "2.16.1",
- "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz",
- "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==",
+ "node_modules/is-async-function": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.1.1.tgz",
+ "integrity": "sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "async-function": "^1.0.0",
+ "call-bound": "^1.0.3",
+ "get-proto": "^1.0.1",
+ "has-tostringtag": "^1.0.2",
+ "safe-regex-test": "^1.1.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-bigint": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.1.0.tgz",
+ "integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-bigints": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-boolean-object": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.2.tgz",
+ "integrity": "sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.3",
+ "has-tostringtag": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-builtin-module": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.2.1.tgz",
+ "integrity": "sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==",
+ "dev": true,
+ "license": "MIT",
+ "peer": true,
+ "dependencies": {
+ "builtin-modules": "^3.3.0"
+ },
+ "engines": {
+ "node": ">=6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/is-callable": {
+ "version": "1.2.7",
+ "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz",
+ "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-core-module": {
+ "version": "2.16.1",
+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz",
+ "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "hasown": "^2.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-data-view": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.2.tgz",
+ "integrity": "sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "get-intrinsic": "^1.2.6",
+ "is-typed-array": "^1.1.13"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-date-object": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz",
+ "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "has-tostringtag": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-docker": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
+ "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "is-docker": "cli.js"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/is-electron": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/is-electron/-/is-electron-2.2.2.tgz",
+ "integrity": "sha512-FO/Rhvz5tuw4MCWkpMzHFKWD2LsfHzIb7i6MdPYZ/KW7AlxawyLkqdy+jPZP1WubqEADE3O4FUENlJHDfQASRg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/is-extglob": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
+ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-finalizationregistry": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz",
+ "integrity": "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/is-generator-fn": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz",
+ "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/is-generator-function": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.0.tgz",
+ "integrity": "sha512-nPUB5km40q9e8UfN/Zc24eLlzdSf9OfKByBw9CIdw4H1giPMeA0OIJvbchsCu4npfI2QcMVBsGEBHKZ7wLTWmQ==",
"dev": true,
"license": "MIT",
"dependencies": {
- "hasown": "^2.0.2"
+ "call-bound": "^1.0.3",
+ "get-proto": "^1.0.0",
+ "has-tostringtag": "^1.0.2",
+ "safe-regex-test": "^1.1.0"
},
"engines": {
"node": ">= 0.4"
@@ -5448,47 +7274,43 @@
"url": "https://github.com/sponsors/ljharb"
}
},
- "node_modules/is-docker": {
- "version": "2.2.1",
- "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
- "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
+ "node_modules/is-glob": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
+ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
"dev": true,
"license": "MIT",
- "bin": {
- "is-docker": "cli.js"
+ "dependencies": {
+ "is-extglob": "^2.1.1"
},
"engines": {
- "node": ">=8"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
+ "node": ">=0.10.0"
}
},
- "node_modules/is-electron": {
- "version": "2.2.2",
- "resolved": "https://registry.npmjs.org/is-electron/-/is-electron-2.2.2.tgz",
- "integrity": "sha512-FO/Rhvz5tuw4MCWkpMzHFKWD2LsfHzIb7i6MdPYZ/KW7AlxawyLkqdy+jPZP1WubqEADE3O4FUENlJHDfQASRg==",
- "dev": true,
- "license": "MIT"
- },
- "node_modules/is-fullwidth-code-point": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
- "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+ "node_modules/is-map": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz",
+ "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==",
"dev": true,
"license": "MIT",
"engines": {
- "node": ">=8"
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
}
},
- "node_modules/is-generator-fn": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz",
- "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==",
+ "node_modules/is-negative-zero": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz",
+ "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==",
"dev": true,
"license": "MIT",
"engines": {
- "node": ">=6"
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/is-number": {
@@ -5501,6 +7323,23 @@
"node": ">=0.12.0"
}
},
+ "node_modules/is-number-object": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz",
+ "integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.3",
+ "has-tostringtag": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/is-path-cwd": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz",
@@ -5564,6 +7403,54 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/is-regex": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz",
+ "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "gopd": "^1.2.0",
+ "has-tostringtag": "^1.0.2",
+ "hasown": "^2.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-set": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz",
+ "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-shared-array-buffer": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz",
+ "integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/is-stream": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
@@ -5577,6 +7464,103 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/is-string": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz",
+ "integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.3",
+ "has-tostringtag": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-symbol": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.1.1.tgz",
+ "integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "has-symbols": "^1.1.0",
+ "safe-regex-test": "^1.1.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-typed-array": {
+ "version": "1.1.15",
+ "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz",
+ "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "which-typed-array": "^1.1.16"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-weakmap": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz",
+ "integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-weakref": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.1.tgz",
+ "integrity": "sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-weakset": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.4.tgz",
+ "integrity": "sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.3",
+ "get-intrinsic": "^1.2.6"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/is-wsl": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
@@ -6620,6 +8604,13 @@
"node": ">=6"
}
},
+ "node_modules/json-buffer": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",
+ "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/json-parse-even-better-errors": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz",
@@ -6634,6 +8625,13 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/json-stable-stringify-without-jsonify": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",
+ "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/json-stringify-safe": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
@@ -6726,6 +8724,16 @@
"safe-buffer": "^5.0.1"
}
},
+ "node_modules/keyv": {
+ "version": "4.5.4",
+ "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
+ "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "json-buffer": "3.0.1"
+ }
+ },
"node_modules/kind-of": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
@@ -6756,6 +8764,20 @@
"node": ">=6"
}
},
+ "node_modules/levn": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
+ "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "prelude-ls": "^1.2.1",
+ "type-check": "~0.4.0"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
"node_modules/lines-and-columns": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
@@ -6868,6 +8890,13 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/lodash.merge": {
+ "version": "4.6.2",
+ "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
+ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/lodash.once": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz",
@@ -7290,42 +9319,126 @@
"node": ">=0.10.0"
}
},
- "node_modules/npm-run-path": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
- "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
+ "node_modules/npm-run-path": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
+ "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "path-key": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/nwsapi": {
+ "version": "2.2.20",
+ "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.20.tgz",
+ "integrity": "sha512-/ieB+mDe4MrrKMT8z+mQL8klXydZWGR5Dowt4RAGKbJ3kIGEx3X4ljUo+6V73IXtUPWgfOlU5B9MlGxFO5T+cA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/object-inspect": {
+ "version": "1.13.4",
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
+ "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/object-keys": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
+ "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/object.assign": {
+ "version": "4.1.7",
+ "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.7.tgz",
+ "integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bind": "^1.0.8",
+ "call-bound": "^1.0.3",
+ "define-properties": "^1.2.1",
+ "es-object-atoms": "^1.0.0",
+ "has-symbols": "^1.1.0",
+ "object-keys": "^1.1.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/object.fromentries": {
+ "version": "2.0.8",
+ "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz",
+ "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==",
"dev": true,
"license": "MIT",
"dependencies": {
- "path-key": "^3.0.0"
+ "call-bind": "^1.0.7",
+ "define-properties": "^1.2.1",
+ "es-abstract": "^1.23.2",
+ "es-object-atoms": "^1.0.0"
},
"engines": {
- "node": ">=8"
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
}
},
- "node_modules/nwsapi": {
- "version": "2.2.20",
- "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.20.tgz",
- "integrity": "sha512-/ieB+mDe4MrrKMT8z+mQL8klXydZWGR5Dowt4RAGKbJ3kIGEx3X4ljUo+6V73IXtUPWgfOlU5B9MlGxFO5T+cA==",
- "dev": true,
- "license": "MIT"
- },
- "node_modules/object-assign": {
- "version": "4.1.1",
- "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
- "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
+ "node_modules/object.groupby": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz",
+ "integrity": "sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==",
"dev": true,
"license": "MIT",
+ "dependencies": {
+ "call-bind": "^1.0.7",
+ "define-properties": "^1.2.1",
+ "es-abstract": "^1.23.2"
+ },
"engines": {
- "node": ">=0.10.0"
+ "node": ">= 0.4"
}
},
- "node_modules/object-inspect": {
- "version": "1.13.4",
- "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
- "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
+ "node_modules/object.values": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.1.tgz",
+ "integrity": "sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA==",
"dev": true,
"license": "MIT",
+ "dependencies": {
+ "call-bind": "^1.0.8",
+ "call-bound": "^1.0.3",
+ "define-properties": "^1.2.1",
+ "es-object-atoms": "^1.0.0"
+ },
"engines": {
"node": ">= 0.4"
},
@@ -7390,6 +9503,42 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/optionator": {
+ "version": "0.9.4",
+ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz",
+ "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "deep-is": "^0.1.3",
+ "fast-levenshtein": "^2.0.6",
+ "levn": "^0.4.1",
+ "prelude-ls": "^1.2.1",
+ "type-check": "^0.4.0",
+ "word-wrap": "^1.2.5"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/own-keys": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.1.tgz",
+ "integrity": "sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "get-intrinsic": "^1.2.6",
+ "object-keys": "^1.1.1",
+ "safe-push-apply": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/p-finally": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
@@ -7523,6 +9672,19 @@
"dev": true,
"license": "BlueOak-1.0.0"
},
+ "node_modules/parent-module": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
+ "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "callsites": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/parse-json": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz",
@@ -7719,6 +9881,26 @@
"node": ">= 6"
}
},
+ "node_modules/possible-typed-array-names": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz",
+ "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/prelude-ls": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
+ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
"node_modules/pretty-format": {
"version": "30.0.5",
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-30.0.5.tgz",
@@ -7836,6 +10018,27 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/queue-microtask": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
+ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT"
+ },
"node_modules/randombytes": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
@@ -7905,6 +10108,29 @@
"node": ">= 10.13.0"
}
},
+ "node_modules/reflect.getprototypeof": {
+ "version": "1.0.10",
+ "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz",
+ "integrity": "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bind": "^1.0.8",
+ "define-properties": "^1.2.1",
+ "es-abstract": "^1.23.9",
+ "es-errors": "^1.3.0",
+ "es-object-atoms": "^1.0.0",
+ "get-intrinsic": "^1.2.7",
+ "get-proto": "^1.0.1",
+ "which-builtin-type": "^1.2.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/regenerate": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz",
@@ -7925,6 +10151,40 @@
"node": ">=4"
}
},
+ "node_modules/regexp.prototype.flags": {
+ "version": "1.5.4",
+ "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz",
+ "integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bind": "^1.0.8",
+ "define-properties": "^1.2.1",
+ "es-errors": "^1.3.0",
+ "get-proto": "^1.0.1",
+ "gopd": "^1.2.0",
+ "set-function-name": "^2.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/regexpp": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz",
+ "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/mysticatea"
+ }
+ },
"node_modules/regexpu-core": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-6.2.0.tgz",
@@ -8050,6 +10310,17 @@
"node": ">=8"
}
},
+ "node_modules/resolve-pkg-maps": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz",
+ "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==",
+ "dev": true,
+ "license": "MIT",
+ "peer": true,
+ "funding": {
+ "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1"
+ }
+ },
"node_modules/retry": {
"version": "0.13.1",
"resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz",
@@ -8060,6 +10331,17 @@
"node": ">= 4"
}
},
+ "node_modules/reusify": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz",
+ "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "iojs": ">=1.0.0",
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/rimraf": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
@@ -8098,6 +10380,57 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/run-parallel": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
+ "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "queue-microtask": "^1.2.2"
+ }
+ },
+ "node_modules/safe-array-concat": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.3.tgz",
+ "integrity": "sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bind": "^1.0.8",
+ "call-bound": "^1.0.2",
+ "get-intrinsic": "^1.2.6",
+ "has-symbols": "^1.1.0",
+ "isarray": "^2.0.5"
+ },
+ "engines": {
+ "node": ">=0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/safe-array-concat/node_modules/isarray": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz",
+ "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
@@ -8119,6 +10452,48 @@
],
"license": "MIT"
},
+ "node_modules/safe-push-apply": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/safe-push-apply/-/safe-push-apply-1.0.0.tgz",
+ "integrity": "sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "isarray": "^2.0.5"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/safe-push-apply/node_modules/isarray": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz",
+ "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/safe-regex-test": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz",
+ "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "es-errors": "^1.3.0",
+ "is-regex": "^1.2.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
@@ -8197,25 +10572,74 @@
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz",
"integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==",
"dev": true,
- "license": "BSD-3-Clause",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "randombytes": "^2.1.0"
+ }
+ },
+ "node_modules/serve-static": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.0.tgz",
+ "integrity": "sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "encodeurl": "^2.0.0",
+ "escape-html": "^1.0.3",
+ "parseurl": "^1.3.3",
+ "send": "^1.2.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/set-function-length": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
+ "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "define-data-property": "^1.1.4",
+ "es-errors": "^1.3.0",
+ "function-bind": "^1.1.2",
+ "get-intrinsic": "^1.2.4",
+ "gopd": "^1.0.1",
+ "has-property-descriptors": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/set-function-name": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz",
+ "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==",
+ "dev": true,
+ "license": "MIT",
"dependencies": {
- "randombytes": "^2.1.0"
+ "define-data-property": "^1.1.4",
+ "es-errors": "^1.3.0",
+ "functions-have-names": "^1.2.3",
+ "has-property-descriptors": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
}
},
- "node_modules/serve-static": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.0.tgz",
- "integrity": "sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==",
+ "node_modules/set-proto": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/set-proto/-/set-proto-1.0.0.tgz",
+ "integrity": "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==",
"dev": true,
"license": "MIT",
"dependencies": {
- "encodeurl": "^2.0.0",
- "escape-html": "^1.0.3",
- "parseurl": "^1.3.3",
- "send": "^1.2.0"
+ "dunder-proto": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "es-object-atoms": "^1.0.0"
},
"engines": {
- "node": ">= 18"
+ "node": ">= 0.4"
}
},
"node_modules/setprototypeof": {
@@ -8466,6 +10890,20 @@
"node": ">= 0.8"
}
},
+ "node_modules/stop-iteration-iterator": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz",
+ "integrity": "sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "internal-slot": "^1.1.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/strict-event-emitter": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/strict-event-emitter/-/strict-event-emitter-0.1.0.tgz",
@@ -8541,6 +10979,65 @@
"node": ">=8"
}
},
+ "node_modules/string.prototype.trim": {
+ "version": "1.2.10",
+ "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.10.tgz",
+ "integrity": "sha512-Rs66F0P/1kedk5lyYyH9uBzuiI/kNRmwJAR9quK6VOtIpZ2G+hMZd+HQbbv25MgCA6gEffoMZYxlTod4WcdrKA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bind": "^1.0.8",
+ "call-bound": "^1.0.2",
+ "define-data-property": "^1.1.4",
+ "define-properties": "^1.2.1",
+ "es-abstract": "^1.23.5",
+ "es-object-atoms": "^1.0.0",
+ "has-property-descriptors": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/string.prototype.trimend": {
+ "version": "1.0.9",
+ "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.9.tgz",
+ "integrity": "sha512-G7Ok5C6E/j4SGfyLCloXTrngQIQU3PWtXGst3yM7Bea9FRURf1S42ZHlZZtsNque2FN2PoUhfZXYLNWwEr4dLQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bind": "^1.0.8",
+ "call-bound": "^1.0.2",
+ "define-properties": "^1.2.1",
+ "es-object-atoms": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/string.prototype.trimstart": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz",
+ "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bind": "^1.0.7",
+ "define-properties": "^1.2.1",
+ "es-object-atoms": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
@@ -8858,19 +11355,6 @@
"url": "https://github.com/chalk/supports-color?sponsor=1"
}
},
- "node_modules/terser/node_modules/acorn": {
- "version": "8.15.0",
- "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
- "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
- "dev": true,
- "license": "MIT",
- "bin": {
- "acorn": "bin/acorn"
- },
- "engines": {
- "node": ">=0.4.0"
- }
- },
"node_modules/terser/node_modules/source-map-support": {
"version": "0.5.21",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
@@ -8897,6 +11381,13 @@
"node": ">=8"
}
},
+ "node_modules/text-table": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
+ "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/through2": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz",
@@ -9087,6 +11578,42 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/tsconfig-paths": {
+ "version": "3.15.0",
+ "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz",
+ "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/json5": "^0.0.29",
+ "json5": "^1.0.2",
+ "minimist": "^1.2.6",
+ "strip-bom": "^3.0.0"
+ }
+ },
+ "node_modules/tsconfig-paths/node_modules/json5": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz",
+ "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "minimist": "^1.2.0"
+ },
+ "bin": {
+ "json5": "lib/cli.js"
+ }
+ },
+ "node_modules/tsconfig-paths/node_modules/strip-bom": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
+ "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
"node_modules/tsscmp": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.6.tgz",
@@ -9097,6 +11624,19 @@
"node": ">=0.6.x"
}
},
+ "node_modules/type-check": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
+ "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "prelude-ls": "^1.2.1"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
"node_modules/type-detect": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
@@ -9135,6 +11675,84 @@
"node": ">= 0.6"
}
},
+ "node_modules/typed-array-buffer": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz",
+ "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.3",
+ "es-errors": "^1.3.0",
+ "is-typed-array": "^1.1.14"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/typed-array-byte-length": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz",
+ "integrity": "sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bind": "^1.0.8",
+ "for-each": "^0.3.3",
+ "gopd": "^1.2.0",
+ "has-proto": "^1.2.0",
+ "is-typed-array": "^1.1.14"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/typed-array-byte-offset": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.4.tgz",
+ "integrity": "sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "available-typed-arrays": "^1.0.7",
+ "call-bind": "^1.0.8",
+ "for-each": "^0.3.3",
+ "gopd": "^1.2.0",
+ "has-proto": "^1.2.0",
+ "is-typed-array": "^1.1.15",
+ "reflect.getprototypeof": "^1.0.9"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/typed-array-length": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.7.tgz",
+ "integrity": "sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bind": "^1.0.7",
+ "for-each": "^0.3.3",
+ "gopd": "^1.0.1",
+ "is-typed-array": "^1.1.13",
+ "possible-typed-array-names": "^1.0.0",
+ "reflect.getprototypeof": "^1.0.6"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/typescript": {
"version": "5.8.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz",
@@ -9156,6 +11774,25 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/unbox-primitive": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz",
+ "integrity": "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.3",
+ "has-bigints": "^1.0.2",
+ "has-symbols": "^1.1.0",
+ "which-boxed-primitive": "^1.1.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/underscore": {
"version": "1.13.7",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.7.tgz",
@@ -9300,6 +11937,16 @@
"browserslist": ">= 4.21.0"
}
},
+ "node_modules/uri-js": {
+ "version": "4.4.1",
+ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
+ "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "punycode": "^2.1.0"
+ }
+ },
"node_modules/util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
@@ -9380,9 +12027,9 @@
}
},
"node_modules/webpack": {
- "version": "5.100.2",
- "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.100.2.tgz",
- "integrity": "sha512-QaNKAvGCDRh3wW1dsDjeMdDXwZm2vqq3zn6Pvq4rHOEOGSaUMgOOjG2Y9ZbIGzpfkJk9ZYTHpDqgDfeBDcnLaw==",
+ "version": "5.101.0",
+ "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.101.0.tgz",
+ "integrity": "sha512-B4t+nJqytPeuZlHuIKTbalhljIFXeNRqrUGAQgTGlfOl2lXXKXw+yZu6bicycP+PUlM44CxBjCFD6aciKFT3LQ==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -9516,19 +12163,6 @@
"node": ">=10.13.0"
}
},
- "node_modules/webpack/node_modules/acorn": {
- "version": "8.15.0",
- "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
- "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
- "dev": true,
- "license": "MIT",
- "bin": {
- "acorn": "bin/acorn"
- },
- "engines": {
- "node": ">=0.4.0"
- }
- },
"node_modules/webpack/node_modules/acorn-import-phases": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/acorn-import-phases/-/acorn-import-phases-1.0.4.tgz",
@@ -9618,6 +12252,102 @@
"node": ">= 8"
}
},
+ "node_modules/which-boxed-primitive": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz",
+ "integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-bigint": "^1.1.0",
+ "is-boolean-object": "^1.2.1",
+ "is-number-object": "^1.1.1",
+ "is-string": "^1.1.1",
+ "is-symbol": "^1.1.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/which-builtin-type": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.2.1.tgz",
+ "integrity": "sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "function.prototype.name": "^1.1.6",
+ "has-tostringtag": "^1.0.2",
+ "is-async-function": "^2.0.0",
+ "is-date-object": "^1.1.0",
+ "is-finalizationregistry": "^1.1.0",
+ "is-generator-function": "^1.0.10",
+ "is-regex": "^1.2.1",
+ "is-weakref": "^1.0.2",
+ "isarray": "^2.0.5",
+ "which-boxed-primitive": "^1.1.0",
+ "which-collection": "^1.0.2",
+ "which-typed-array": "^1.1.16"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/which-builtin-type/node_modules/isarray": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz",
+ "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/which-collection": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.2.tgz",
+ "integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-map": "^2.0.3",
+ "is-set": "^2.0.3",
+ "is-weakmap": "^2.0.2",
+ "is-weakset": "^2.0.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/which-typed-array": {
+ "version": "1.1.19",
+ "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.19.tgz",
+ "integrity": "sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "available-typed-arrays": "^1.0.7",
+ "call-bind": "^1.0.8",
+ "call-bound": "^1.0.4",
+ "for-each": "^0.3.5",
+ "get-proto": "^1.0.1",
+ "gopd": "^1.2.0",
+ "has-tostringtag": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/wildcard": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.1.tgz",
@@ -9625,6 +12355,16 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/word-wrap": {
+ "version": "1.2.5",
+ "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz",
+ "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/wrap-ansi": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
diff --git a/package.json b/package.json
index 0d853ade..3a7b6bef 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "contentstack",
- "version": "3.26.1",
+ "version": "3.26.2",
"description": "Contentstack Javascript SDK",
"homepage": "https://www.contentstack.com/",
"author": {
@@ -24,7 +24,10 @@
"build": "npm run build:node && npm run build:web && npm run build:react-native && npm run build:native-script",
"generate-docs": "node_modules/.bin/jsdoc --configure docs-config.json --verbose",
"prepare": "npm run build",
- "pretest": "npm run build"
+ "husky-check": "husky install && npx husky && chmod +x .husky/pre-commit",
+ "pretest": "npm run build",
+ "lint": "eslint src test",
+ "format": "eslint src test --fix"
},
"repository": {
"type": "git",
@@ -66,12 +69,19 @@
},
"devDependencies": {
"@babel/core": "^7.28.0",
+ "@babel/eslint-parser": "^7.28.0",
"@babel/preset-env": "^7.28.0",
"@slack/bolt": "^4.4.0",
"@types/jest": "^30.0.0",
"babel-loader": "^10.0.0",
"clean-webpack-plugin": "^4.0.0",
- "dotenv": "^17.2.0",
+ "dotenv": "^17.2.1",
+ "eslint": "^8.57.1",
+ "eslint-config-standard": "^17.1.0",
+ "eslint-plugin-import": "^2.32.0",
+ "eslint-plugin-node": "^11.1.0",
+ "eslint-plugin-promise": "^6.6.0",
+ "eslint-plugin-standard": "^4.1.0",
"jest": "^30.0.5",
"jest-html-reporters": "^3.1.7",
"jsdoc": "^4.0.4",
@@ -83,7 +93,7 @@
"tap-json": "1.0.0",
"ts-jest": "^29.4.0",
"typescript": "^5.8.3",
- "webpack": "^5.100.2",
+ "webpack": "^5.101.0",
"webpack-cli": "^6.0.1",
"webpack-merge": "6.0.1",
"webpack-node-externals": "^3.0.0"
@@ -91,6 +101,7 @@
"dependencies": {
"@contentstack/utils": "^1.4.1",
"es6-promise": "^4.2.8",
+ "husky": "^9.1.7",
"localStorage": "1.0.4"
}
}
diff --git a/src/core/cache-provider/index.js b/src/core/cache-provider/index.js
index 0390d594..7f12b9be 100755
--- a/src/core/cache-provider/index.js
+++ b/src/core/cache-provider/index.js
@@ -1,21 +1,20 @@
import localstorage from './localstorage';
-var CacheProvider = {};
+const CacheProvider = {};
-
-CacheProvider.providers = function(provider) {
- if (provider) {
- return localstorage;
- } else {
- console.error("Kindly provide valid provider.");
- }
+CacheProvider.providers = function (provider) {
+ if (provider) {
+ return localstorage;
+ } else {
+ console.error('Kindly provide valid provider.');
+ }
};
CacheProvider.policies = {
- IGNORE_CACHE: -1,
- ONLY_NETWORK: 0,
- CACHE_ELSE_NETWORK: 1,
- NETWORK_ELSE_CACHE: 2,
- CACHE_THEN_NETWORK: 3
+ IGNORE_CACHE: -1,
+ ONLY_NETWORK: 0,
+ CACHE_ELSE_NETWORK: 1,
+ NETWORK_ELSE_CACHE: 2,
+ CACHE_THEN_NETWORK: 3
};
-export default CacheProvider;
\ No newline at end of file
+export default CacheProvider;
diff --git a/src/core/cache-provider/localstorage.js b/src/core/cache-provider/localstorage.js
index c81daf30..4952be4d 100755
--- a/src/core/cache-provider/localstorage.js
+++ b/src/core/cache-provider/localstorage.js
@@ -1,76 +1,76 @@
import * as cache from './../cache';
-let localStorage = {};
+let localStorage = {}; // eslint-disable-line
localStorage.get = function (key, callback) {
- try {
- callback(null, cache.get(key));
- } catch(e) {
- callback(e);
- }
+ try {
+ callback(null, cache.get(key));
+ } catch (e) {
+ callback(e);
+ }
};
localStorage.set = function (key, value, callback) {
- try {
- if(key && value) cache.set(key, value);
- callback();
- } catch(e) {
- callback(e);
- }
+ try {
+ if (key && value) cache.set(key, value);
+ callback();
+ } catch (e) {
+ callback(e);
+ }
};
-function clearValuesForKey(keyArray, append) {
- if(!append && keyArray && keyArray.length) keyArray.push('');
- let _key,
- keys = cache.getKeys(),
- storage = cache.getStorage();
- if(!keyArray || !keyArray.length) {
- for(let i = 0, _i = keys.length; i < _i; i++) {
- delete storage[keys[i]];
- }
- } else {
- _key = keyArray.join('.');
- for(let i = 0, _i = keys.length; i < _i; i++) {
- if(keys[i] && keys[i].indexOf(_key) === 0) delete storage[keys[i]];
- }
+function clearValuesForKey (keyArray, append) {
+ if (!append && keyArray && keyArray.length) keyArray.push('');
+ let _key;
+ const keys = cache.getKeys();
+ const storage = cache.getStorage();
+ if (!keyArray || !keyArray.length) {
+ for (let i = 0, _i = keys.length; i < _i; i++) {
+ delete storage[keys[i]];
+ }
+ } else {
+ _key = keyArray.join('.');
+ for (let i = 0, _i = keys.length; i < _i; i++) {
+ if (keys[i] && keys[i].indexOf(_key) === 0) delete storage[keys[i]];
}
+ }
}
localStorage.clearByContentType = function () {
- try {
- if(arguments.length === 2 || arguments.length === 3) {
- let args = Array.prototype.slice.call(arguments);
- let callback = args.splice(-1, 1).pop();
- let valueArray = [];
- valueArray.push.apply(valueArray, args);
- clearValuesForKey(valueArray);
- callback();
- }
- } catch(e) {
- callback(e);
+ try {
+ if (arguments.length === 2 || arguments.length === 3) {
+ const args = Array.prototype.slice.call(arguments);
+ const callback = args.splice(-1, 1).pop();
+ const valueArray = [];
+ valueArray.push.apply(valueArray, args);
+ clearValuesForKey(valueArray);
+ callback();
}
-}
+ } catch (e) {
+ callback(e);
+ }
+};
localStorage.clearByQuery = function (query, callback) {
- try {
- let keys = cache.getKeys(),
- storage = cache.getStorage();
- for(let i = 0, _i = keys.length; i < _i; i++) {
- if(keys[i] && ~keys[i].indexOf(query)) delete storage[keys[i]];
- }
- callback();
- } catch(e) {
- callback(e);
+ try {
+ const keys = cache.getKeys();
+ const storage = cache.getStorage();
+ for (let i = 0, _i = keys.length; i < _i; i++) {
+ if (keys[i] && ~keys[i].indexOf(query)) delete storage[keys[i]];
}
-}
+ callback();
+ } catch (e) {
+ callback(e);
+ }
+};
localStorage.clearAll = function (callback) {
- try {
- clearValuesForKey();
- callback();
- } catch(e) {
- callback(e);
- }
-}
+ try {
+ clearValuesForKey();
+ callback();
+ } catch (e) {
+ callback(e);
+ }
+};
-export default localStorage;
\ No newline at end of file
+export default localStorage;
diff --git a/src/core/cache.js b/src/core/cache.js
index 59181988..4c6de26e 100755
--- a/src/core/cache.js
+++ b/src/core/cache.js
@@ -1,30 +1,30 @@
import storage from 'runtime/localstorage.js';
-export function get(key) {
- let data = storage.getItem(key);
- try {
- data = JSON.parse(data);
- } catch (e) {
- return data;
- }
- return data || null;
+export function get (key) {
+ let data = storage.getItem(key);
+ try {
+ data = JSON.parse(data);
+ } catch (e) {
+ return data;
+ }
+ return data || null;
}
-export function set(key, data) {
- try {
- if (typeof data === 'object') {
- storage.setItem(key, JSON.stringify(data));
- } else {
- storage.setItem(key, data);
- }
- } catch (error) {
- }
+export function set (key, data) {
+ try {
+ if (typeof data === 'object') {
+ storage.setItem(key, JSON.stringify(data));
+ } else {
+ storage.setItem(key, data);
+ }
+ } catch (error) {
+ }
}
-export function getStorage() {
- return storage || null;
+export function getStorage () {
+ return storage || null;
}
-export function getKeys() {
- return (storage) ? Object.keys(storage) : [];
+export function getKeys () {
+ return (storage) ? Object.keys(storage) : [];
}
diff --git a/src/core/contentstack.js b/src/core/contentstack.js
index 89e74a1d..505a6f80 100755
--- a/src/core/contentstack.js
+++ b/src/core/contentstack.js
@@ -1,16 +1,15 @@
-import Stack from "./stack";
+import Stack from './stack';
import CacheProvider from './cache-provider/index';
-import ContentstackRegion from "./contentstackregion";
+import ContentstackRegion from './contentstackregion';
- /**
- * @class Contentstack
+/**
+ * @class Contentstack
* @description Creates an instance of `Contentstack`.
* @instance
*/
class Contentstack {
-
- constructor(){
- /**
+ constructor () {
+ /**
* @memberOf Contentstack
* @description CachePolicy contains different cache policies constants.
* @example
@@ -20,78 +19,76 @@ class Contentstack {
* Contentstack.CachePolicy.NETWORK_ELSE_CACHE
* Contentstack.CachePolicy.CACHE_THEN_NETWORK
*/
- this.CachePolicy = CacheProvider.policies;
- this.Region = ContentstackRegion;
-
- this.Utils = require('@contentstack/utils');
- }
+ this.CachePolicy = CacheProvider.policies;
+ this.Region = ContentstackRegion;
+
+ this.Utils = require('@contentstack/utils');
+ }
- /**
+ /**
* @memberOf Contentstack
*/
- Stack(...stack_arguments){
- return new Stack(...stack_arguments);
- }
-
- updateAssetURL(entry) {
- // check if entry consist of _embedded_items object
- if (entry._embedded_items == undefined) {
- throw new Error("_embedded_items not present in entry. Call includeEmbeddedItems() before fetching entry.");
- }
-
- // Iterate through each object in _embedded_items and update the asset link
- for (let key in entry._embedded_items) {
- let embedded_item = entry._embedded_items[key];
+ Stack (...stack_arguments) {
+ return new Stack(...stack_arguments);
+ }
- if (Array.isArray(embedded_item)) {
- embedded_item.forEach((item) => {
+ updateAssetURL (entry) {
+ // check if entry consist of _embedded_items object
+ if (entry._embedded_items == undefined) {
+ throw new Error('_embedded_items not present in entry. Call includeEmbeddedItems() before fetching entry.');
+ }
- if (item._content_type_uid == 'sys_assets' && item.filename) {
+ // Iterate through each object in _embedded_items and update the asset link
+ for (const key in entry._embedded_items) {
+ const embedded_item = entry._embedded_items[key];
- let correspondingAsset;
- const x = (children) => {
- for (let i = 0; i < children.length; i++) {
- if (children[i].children && children[i].children.length) {
- x(children[i].children);
- }
- if (children[i].attrs && children[i].attrs['asset-uid'] === item.uid) {
- correspondingAsset = children[i].attrs;
- return;
- }
- }
- };
+ if (Array.isArray(embedded_item)) {
+ embedded_item.forEach((item) => {
+ if (item._content_type_uid == 'sys_assets' && item.filename) {
+ let correspondingAsset;
+ const x = (children) => {
+ for (let i = 0; i < children.length; i++) {
+ if (children[i].children && children[i].children.length) {
+ x(children[i].children);
+ }
+ if (children[i].attrs && children[i].attrs['asset-uid'] === item.uid) {
+ correspondingAsset = children[i].attrs;
+ return;
+ }
+ }
+ };
- let _entry = { ...entry };
- const keys = key.split(".");
- const unsafeKeys = new Set(["__proto__", "constructor", "prototype"]);
+ let _entry = { ...entry };
+ const keys = key.split('.');
+ const unsafeKeys = new Set(['__proto__', 'constructor', 'prototype']);
- for (const k of keys) {
- // Ensure key is safe before accessing it
- if (unsafeKeys.has(k)) continue;
+ for (const k of keys) {
+ // Ensure key is safe before accessing it
+ if (unsafeKeys.has(k)) continue;
- if (_entry && typeof _entry === "object" && _entry !== null && Object.prototype.hasOwnProperty.call(_entry, k)) {
- const newEntry = _entry[k];
- if (typeof newEntry === "object" && newEntry !== null) {
- _entry = newEntry;
- }
- } else if (Array.isArray(_entry)) {
- for (const block of _entry) {
- if (block && typeof block === "object" && Object.prototype.hasOwnProperty.call(block, k)) {
- _entry = block[k];
- }
- }
- }
- }
- if (_entry.children) x(_entry.children);
- if (correspondingAsset) {
- correspondingAsset['href'] = item.url;
- }
- }
- });
- }
- }
- }
+ if (_entry && typeof _entry === 'object' && _entry !== null && Object.prototype.hasOwnProperty.call(_entry, k)) {
+ const newEntry = _entry[k];
+ if (typeof newEntry === 'object' && newEntry !== null) {
+ _entry = newEntry;
+ }
+ } else if (Array.isArray(_entry)) {
+ for (const block of _entry) {
+ if (block && typeof block === 'object' && Object.prototype.hasOwnProperty.call(block, k)) {
+ _entry = block[k];
+ }
+ }
+ }
+ }
+ if (_entry.children) x(_entry.children);
+ if (correspondingAsset) {
+ correspondingAsset.href = item.url;
+ }
+ }
+ });
+ }
+ }
+ }
}
module.exports = new Contentstack();
diff --git a/src/core/contentstackregion.js b/src/core/contentstackregion.js
index f285e8ed..4e565902 100644
--- a/src/core/contentstackregion.js
+++ b/src/core/contentstackregion.js
@@ -1,11 +1,11 @@
const ContentstackRegion = {
- EU: "eu",
- US: "us",
- AU: "au",
- AZURE_NA: "azure-na",
- AZURE_EU: "azure-eu",
- GCP_NA: "gcp-na",
- GCP_EU: "gcp-eu"
+ EU: 'eu',
+ US: 'us',
+ AU: 'au',
+ AZURE_NA: 'azure-na',
+ AZURE_EU: 'azure-eu',
+ GCP_NA: 'gcp-na',
+ GCP_EU: 'gcp-eu'
};
-export default ContentstackRegion;
\ No newline at end of file
+export default ContentstackRegion;
diff --git a/src/core/lib/request.js b/src/core/lib/request.js
index 239c0048..3a24c7a7 100755
--- a/src/core/lib/request.js
+++ b/src/core/lib/request.js
@@ -1,143 +1,136 @@
-import * as Utils from "./utils.js";
-import fetch from "runtime/http.js";
+import * as Utils from './utils.js';
+import fetch from 'runtime/http.js';
-//JS SDK version
-let version = '{{VERSION}}';
+// JS SDK version
+const version = '{{VERSION}}';
let environment,
- api_key;
-export default function Request(stack, fetchOptions) {
- let requestParams = stack.requestParams;
- return new Promise(function(resolve, reject) {
- let queryParams;
-
- const params = new URLSearchParams();
- let serialize = function (obj, prefix) {
- if (typeof obj === 'object' && obj.length !== undefined) {
- for (let i = 0, _i = obj.length; i < _i; i++) {
- params.append(prefix + '[]', obj[i]);
- }
- } else {
- for (const p in obj) {
- let k = prefix ? prefix + '[' + p + ']' : p,
- v = obj[p];
- v !== null && typeof v === 'object' && p !== 'query'
- ? serialize(v, k)
- : params.append(k, p !== 'query' ? v : JSON.stringify(v));
- }
- }
- return params.toString();
- };
-
- // setting headers
- requestParams.headers['Content-Type'] = 'application/json; charset=UTF-8';
- requestParams.headers['X-User-Agent'] = 'contentstack-delivery-javascript-{{PLATFORM}}/' + version;
-
- if (requestParams.body && typeof requestParams.body === 'object') {
- delete requestParams.body._method;
- if (typeof requestParams.body.query === "object" && Object.keys(requestParams.body.query).length === 0) delete requestParams.body.query;
- queryParams = serialize(requestParams.body);
+ api_key;
+export default function Request (stack, fetchOptions) {
+ const requestParams = stack.requestParams;
+ return new Promise(function (resolve, reject) {
+ let queryParams;
+
+ const params = new URLSearchParams();
+ const serialize = function (obj, prefix) {
+ if (typeof obj === 'object' && obj.length !== undefined) {
+ for (let i = 0, _i = obj.length; i < _i; i++) {
+ params.append(prefix + '[]', obj[i]);
+ }
+ } else {
+ for (const p in obj) {
+ const k = prefix ? prefix + '[' + p + ']' : p;
+ const v = obj[p];
+ v !== null && typeof v === 'object' && p !== 'query'
+ ? serialize(v, k)
+ : params.append(k, p !== 'query' ? v : JSON.stringify(v));
}
+ }
+ return params.toString();
+ };
+
+ // setting headers
+ requestParams.headers['Content-Type'] = 'application/json; charset=UTF-8';
+ requestParams.headers['X-User-Agent'] = 'contentstack-delivery-javascript-{{PLATFORM}}/' + version;
+
+ if (requestParams.body && typeof requestParams.body === 'object') {
+ delete requestParams.body._method;
+ if (typeof requestParams.body.query === 'object' && Object.keys(requestParams.body.query).length === 0) delete requestParams.body.query;
+ queryParams = serialize(requestParams.body);
+ }
- return fetchRetry(stack, queryParams,
- fetchOptions,
- resolve,
- reject,
- fetchOptions.retryDelay,
- fetchOptions.retryLimit)
-
- });
+ return fetchRetry(stack, queryParams,
+ fetchOptions,
+ resolve,
+ reject,
+ fetchOptions.retryDelay,
+ fetchOptions.retryLimit);
+ });
}
-function wait(retryDelay) {
- return new Promise((resolve) => {
- setTimeout(resolve, retryDelay)
- });
+function wait (retryDelay) {
+ return new Promise((resolve) => {
+ setTimeout(resolve, retryDelay);
+ });
}
-function fetchRetry(stack, queryParams, fetchOptions, resolve, reject, retryDelay = 300, retryLimit = 5) {
- const requestParams = stack.requestParams,
- url = requestParams.url + '?' + queryParams,
- headers = requestParams.headers
- const option = Utils.mergeDeep({
- method: 'GET',
- headers: headers,
- timeout: 30000,
- },
- fetchOptions);
-
- function onError (error) {
- if (retryLimit === 0) {
- if (fetchOptions.debug) fetchOptions.logHandler('error', error);
- reject(error);
- }else {
- var msDelay = retryDelay
- retryLimit = retryLimit - 1
- var retryCount = (fetchOptions.retryLimit - retryLimit)
- if (fetchOptions.retryDelayOptions) {
- if (fetchOptions.retryDelayOptions.base) {
- msDelay = fetchOptions.retryDelayOptions.base * retryCount
- } else if (fetchOptions.retryDelayOptions.customBackoff) {
- msDelay = fetchOptions.retryDelayOptions.customBackoff(retryCount, error)
- }
- }
- wait(msDelay)
- .then(() => {
- return fetchRetry(stack, queryParams, fetchOptions, resolve, reject, retryDelay, retryLimit)
- })
- .catch(() => {
- return fetchRetry(stack, queryParams, fetchOptions, resolve, reject, retryDelay, retryLimit)
- })
+function fetchRetry (stack, queryParams, fetchOptions, resolve, reject, retryDelay = 300, retryLimit = 5) {
+ const requestParams = stack.requestParams;
+ const url = requestParams.url + '?' + queryParams;
+ const headers = requestParams.headers;
+ const option = Utils.mergeDeep({
+ method: 'GET',
+ headers,
+ timeout: 30000
+ },
+ fetchOptions);
+
+ function onError (error) {
+ if (retryLimit === 0) {
+ if (fetchOptions.debug) fetchOptions.logHandler('error', error);
+ reject(error);
+ } else {
+ let msDelay = retryDelay;
+ retryLimit = retryLimit - 1;
+ const retryCount = (fetchOptions.retryLimit - retryLimit);
+ if (fetchOptions.retryDelayOptions) {
+ if (fetchOptions.retryDelayOptions.base) {
+ msDelay = fetchOptions.retryDelayOptions.base * retryCount;
+ } else if (fetchOptions.retryDelayOptions.customBackoff) {
+ msDelay = fetchOptions.retryDelayOptions.customBackoff(retryCount, error);
}
+ }
+ wait(msDelay)
+ .then(() => {
+ return fetchRetry(stack, queryParams, fetchOptions, resolve, reject, retryDelay, retryLimit);
+ })
+ .catch(() => {
+ return fetchRetry(stack, queryParams, fetchOptions, resolve, reject, retryDelay, retryLimit);
+ });
}
+ }
- if (fetchOptions.debug) fetchOptions.logHandler('info', { url: url, option: option});
-
- let request = {url, option};
-
- let plugins = stack.plugins;
- if (plugins && plugins !== undefined) {
+ if (fetchOptions.debug) fetchOptions.logHandler('info', { url, option });
- for (let index = 0; index < plugins.length; index++) {
+ let request = { url, option };
- if (typeof plugins[index].onRequest === 'function') {
- request = plugins[index].onRequest(stack, request)
- }
- }
+ const plugins = stack.plugins;
+ if (plugins && plugins !== undefined) {
+ for (let index = 0; index < plugins.length; index++) {
+ if (typeof plugins[index].onRequest === 'function') {
+ request = plugins[index].onRequest(stack, request);
+ }
}
+ }
-
- fetch(request.url, request.option)
- .then( function(response) {
-
- if (fetchOptions.debug) fetchOptions.logHandler('info', response);
- const data = response.json();
-
- if (response.ok && response.status === 200) {
- data.then(json => {
- for (let index = 0; index < plugins.length && typeof plugins[index].onResponse === 'function'; index++)
- json = plugins[index].onResponse(stack, request , response, json)
+ fetch(request.url, request.option)
+ .then(function (response) {
+ if (fetchOptions.debug) fetchOptions.logHandler('info', response);
+ const data = response.json();
- resolve(json);
- })
+ if (response.ok && response.status === 200) {
+ data.then(json => {
+ for (let index = 0; index < plugins.length && typeof plugins[index].onResponse === 'function'; index++) { json = plugins[index].onResponse(stack, request, response, json); }
- } else {
- const {status, statusText} = response
- data.then((json) => {
- const {error_message, error_code, errors} = json
- const errorDetails = { error_message, error_code, errors, status, statusText }
- if (fetchOptions.retryCondition && fetchOptions.retryCondition(response)) {
- onError(errorDetails)
- } else {
- if (fetchOptions.debug) fetchOptions.logHandler('error', errorDetails);
- reject(errorDetails)
- }
- }).catch(() => {
- if (fetchOptions.debug) fetchOptions.logHandler('error', {status, statusText});
- reject({status, statusText})
- });
- }
- }).catch((error) => {
- if (fetchOptions.debug) fetchOptions.logHandler('error', error);
- reject(error)
+ resolve(json);
});
+ } else {
+ const { status, statusText } = response;
+ data.then((json) => {
+ const { error_message, error_code, errors } = json;
+ const errorDetails = { error_message, error_code, errors, status, statusText };
+ if (fetchOptions.retryCondition && fetchOptions.retryCondition(response)) {
+ onError(errorDetails);
+ } else {
+ if (fetchOptions.debug) fetchOptions.logHandler('error', errorDetails);
+ reject(errorDetails);
+ }
+ }).catch(() => {
+ if (fetchOptions.debug) fetchOptions.logHandler('error', { status, statusText });
+ reject({ status, statusText });
+ });
+ }
+ }).catch((error) => {
+ if (fetchOptions.debug) fetchOptions.logHandler('error', error);
+ reject(error);
+ });
}
diff --git a/src/core/lib/utils.js b/src/core/lib/utils.js
index 05af3cd1..4aaa9330 100755
--- a/src/core/lib/utils.js
+++ b/src/core/lib/utils.js
@@ -5,411 +5,402 @@ import Result from '../modules/result';
* @method addSpread
* @description method to add the spread.
*/
-(function addSpread() {
- if (Promise.prototype.spread) return;
- Promise.prototype.spread = function(fn, errFunc) {
- errFunc = errFunc || function(err) {};
- return this.then(function(args) {
- return fn.apply(fn, args);
- }).catch(function(err) {
- errFunc(err);
- });
- };
+(function addSpread () {
+ if (Promise.prototype.spread) return;
+ Promise.prototype.spread = function (fn, errFunc) {
+ errFunc = errFunc || function (err) {};
+ return this.then(function (args) {
+ return fn.apply(fn, args);
+ }).catch(function (err) {
+ errFunc(err);
+ });
+ };
}());
-export function transform(type) {
- return function() {
- this._query[type] = this._query[type] || {};
- switch (arguments.length) {
- case 1:
- if (Array.isArray(arguments[0]) || typeof arguments[0] === "string") {
- let query = this._query[type]['BASE'] || [];
- query = query.concat(arguments[0]);
- this._query[type]['BASE'] = query;
- return this;
- } else {
- console.error("Kindly provide valid parameters");
- }
- break;
- case 2:
- if (typeof arguments[0] === "string" && (Array.isArray(arguments[1]) || typeof arguments[1] === "string")) {
- let query = this._query[type][arguments[0]] || [];
- query = query.concat(arguments[1]);
- this._query[type][arguments[0]] = query;
- return this;
- } else {
- console.error("Kindly provide valid parameters");
- }
- break;
- default:
- console.error("Kindly provide valid parameters");
+export function transform (type) {
+ return function () {
+ this._query[type] = this._query[type] || {};
+ switch (arguments.length) {
+ case 1:
+ if (Array.isArray(arguments[0]) || typeof arguments[0] === 'string') {
+ let query = this._query[type].BASE || [];
+ query = query.concat(arguments[0]);
+ this._query[type].BASE = query;
+ return this;
+ } else {
+ console.error('Kindly provide valid parameters');
}
- };
+ break;
+ case 2:
+ if (typeof arguments[0] === 'string' && (Array.isArray(arguments[1]) || typeof arguments[1] === 'string')) {
+ let query = this._query[type][arguments[0]] || [];
+ query = query.concat(arguments[1]);
+ this._query[type][arguments[0]] = query;
+ return this;
+ } else {
+ console.error('Kindly provide valid parameters');
+ }
+ break;
+ default:
+ console.error('Kindly provide valid parameters');
+ }
+ };
}
-export function _type(val) {
- let _typeof,
- __typeof = typeof val;
- if (__typeof === "object") {
- _typeof = __typeof;
- if (Array.isArray(val)) {
- __typeof = 'array';
- }
- } else {
- _typeof = __typeof;
+export function _type (val) {
+ let _typeof;
+ let __typeof = typeof val;
+ if (__typeof === 'object') {
+ _typeof = __typeof;
+ if (Array.isArray(val)) {
+ __typeof = 'array';
}
- return __typeof;
+ } else {
+ _typeof = __typeof;
+ }
+ return __typeof;
}
// merge two objects
-export function mergeDeep(destination, sourceVar) {
- let self = this;
- let _merge_recursive = function(target, source) {
- for (let key in source) {
- if (self._type(source[key]) == 'object' && self._type(target[key]) == self._type(source[key])) {
- _merge_recursive(target[key], source[key])
- } else if (self._type(source[key]) == 'array' && self._type(target[key]) == self._type(source[key])) {
- target[key] = target[key].concat(source[key]);
- } else {
- target[key] = source[key];
- }
- }
- };
- _merge_recursive(destination, sourceVar);
- return destination;
+export function mergeDeep (destination, sourceVar) {
+ const self = this;
+ const _merge_recursive = function (target, source) {
+ for (const key in source) {
+ if (self._type(source[key]) == 'object' && self._type(target[key]) == self._type(source[key])) {
+ _merge_recursive(target[key], source[key]);
+ } else if (self._type(source[key]) == 'array' && self._type(target[key]) == self._type(source[key])) {
+ target[key] = target[key].concat(source[key]);
+ } else {
+ target[key] = source[key];
+ }
+ }
+ };
+ _merge_recursive(destination, sourceVar);
+ return destination;
}
// merge two objects
-export function merge(target, source) {
- if (target && source) {
- for (let key in source) {
- target[key] = source[key];
- }
+export function merge (target, source) {
+ if (target && source) {
+ for (const key in source) {
+ target[key] = source[key];
}
- return target;
+ }
+ return target;
}
// return true if process is running in browser else false
-export function isBrowser() {
- return (typeof window !== "undefined");
+export function isBrowser () {
+ return (typeof window !== 'undefined');
}
-
// return the query from the params
-export function parseQueryFromParams(queryObject, single, toJSON) {
- if (queryObject && queryObject.requestParams) {
- let _query = merge({}, ((queryObject.requestParams.body) ? queryObject.requestParams.body.query || {} : {}));
- if (_query.environment_uid) {
- delete _query.environment_uid;
- _query.environment = queryObject.environment;
- }
- _query.environment = queryObject.environment;
- return {
- content_type_uid: queryObject.content_type_uid,
- locale: _query.locale || 'en-us',
- query: _query,
- entry_uid: queryObject.entry_uid,
- asset_uid: queryObject.asset_uid,
- single: single || "false",
- toJSON: toJSON || "false",
- api_key: (queryObject.requestParams.headers) ? queryObject.requestParams.headers.api_key : ""
- };
+export function parseQueryFromParams (queryObject, single, toJSON) {
+ if (queryObject && queryObject.requestParams) {
+ const _query = merge({}, ((queryObject.requestParams.body) ? queryObject.requestParams.body.query || {} : {}));
+ if (_query.environment_uid) {
+ delete _query.environment_uid;
+ _query.environment = queryObject.environment;
}
+ _query.environment = queryObject.environment;
+ return {
+ content_type_uid: queryObject.content_type_uid,
+ locale: _query.locale || 'en-us',
+ query: _query,
+ entry_uid: queryObject.entry_uid,
+ asset_uid: queryObject.asset_uid,
+ single: single || 'false',
+ toJSON: toJSON || 'false',
+ api_key: (queryObject.requestParams.headers) ? queryObject.requestParams.headers.api_key : ''
+ };
+ }
}
// return the hash value of the query
-export function getHash(query) {
- try {
- let hashValue = generateHash(JSON.stringify(query)),
- keyArray = [];
- keyArray.push(query.content_type_uid);
- keyArray.push(query.locale);
- if (query.entry_uid) keyArray.push(query.entry_uid);
- if (query.asset_uid) keyArray.push(query.asset_uid);
- keyArray.push(hashValue);
- return keyArray.join('.');
- } catch (e) {}
+export function getHash (query) {
+ try {
+ const hashValue = generateHash(JSON.stringify(query));
+ const keyArray = [];
+ keyArray.push(query.content_type_uid);
+ keyArray.push(query.locale);
+ if (query.entry_uid) keyArray.push(query.entry_uid);
+ if (query.asset_uid) keyArray.push(query.asset_uid);
+ keyArray.push(hashValue);
+ return keyArray.join('.');
+ } catch (e) {}
}
// return the hash value of the string
-export function generateHash(str) {
- let hash = 0,
- i, chr, len;
- if (str.length === 0) return hash;
- for (i = 0, len = str.length; i < len; i++) {
- chr = str.charCodeAt(i);
- hash = ((hash << 5) - hash) + chr;
- hash |= 0; // Convert to 32bit integer
- }
- return ((hash < -1) ? hash * -1 : hash);
+export function generateHash (str) {
+ let hash = 0;
+ let i; let chr; let len;
+ if (str.length === 0) return hash;
+ for (i = 0, len = str.length; i < len; i++) {
+ chr = str.charCodeAt(i);
+ hash = ((hash << 5) - hash) + chr;
+ hash |= 0; // Convert to 32bit integer
+ }
+ return ((hash < -1) ? hash * -1 : hash);
}
// generate the Result object
-export function resultWrapper(result) {
- if (result && typeof result.entries !== 'undefined') {
- if (result.entries && result.entries.length) {
- for (let i = 0, _i = result.entries.length; i < _i; i++) {
- result.entries[i] = Result(result.entries[i]);
- }
- } else {
- result.entries = [];
- }
- } else if (result && result.assets && typeof result.assets !== 'undefined') {
- if (result.assets && result.assets.length) {
- for (let j = 0, _j = result.assets.length; j < _j; j++) {
- result.assets[j] = Result(result.assets[j]);
- }
- } else {
- result.assets = [];
- }
- } else if (result && typeof result.entry !== 'undefined') {
- result.entry = Result(result.entry);
- } else if (result && typeof result.asset !== 'undefined') {
- result.asset = Result(result.asset);
- } else if (result && typeof result.items !== 'undefined') {
- result.items = Result(result.items).toJSON();
+export function resultWrapper (result) {
+ if (result && typeof result.entries !== 'undefined') {
+ if (result.entries && result.entries.length) {
+ for (let i = 0, _i = result.entries.length; i < _i; i++) {
+ result.entries[i] = Result(result.entries[i]);
+ }
+ } else {
+ result.entries = [];
}
+ } else if (result && result.assets && typeof result.assets !== 'undefined') {
+ if (result.assets && result.assets.length) {
+ for (let j = 0, _j = result.assets.length; j < _j; j++) {
+ result.assets[j] = Result(result.assets[j]);
+ }
+ } else {
+ result.assets = [];
+ }
+ } else if (result && typeof result.entry !== 'undefined') {
+ result.entry = Result(result.entry);
+ } else if (result && typeof result.asset !== 'undefined') {
+ result.asset = Result(result.asset);
+ } else if (result && typeof result.items !== 'undefined') {
+ result.items = Result(result.items).toJSON();
+ }
- return result;
+ return result;
}
// spread the result object
-export function spreadResult(result) {
- let _results = [];
- if (result && Object.keys(result).length) {
- if (typeof result.entries !== 'undefined') {
- _results.push(result.entries);
- if(result.content_type){
- _results['schema'] = result.content_type
- }
- }
- if (typeof result.assets !== 'undefined') _results.push(result.assets);
- if (typeof result.content_type !== 'undefined' || typeof result.schema !== 'undefined') _results.push(result.content_type || result.schema);
- if (typeof result.count !== 'undefined') _results.push(result.count);
- if (typeof result.entry !== 'undefined') {
- _results = result.entry;
- if(result.schema){
- _results['schema'] = result.schema
- }
- if(result.content_type){
- _results['content_type'] = result.content_type
- }
- }
- if (typeof result.asset !== 'undefined') _results = result.asset;
- if (typeof result.items !== 'undefined') _results.push(result);
+export function spreadResult (result) {
+ let _results = [];
+ if (result && Object.keys(result).length) {
+ if (typeof result.entries !== 'undefined') {
+ _results.push(result.entries);
+ if (result.content_type) {
+ _results.schema = result.content_type;
+ }
+ }
+ if (typeof result.assets !== 'undefined') _results.push(result.assets);
+ if (typeof result.content_type !== 'undefined' || typeof result.schema !== 'undefined') _results.push(result.content_type || result.schema);
+ if (typeof result.count !== 'undefined') _results.push(result.count);
+ if (typeof result.entry !== 'undefined') {
+ _results = result.entry;
+ if (result.schema) {
+ _results.schema = result.schema;
+ }
+ if (result.content_type) {
+ _results.content_type = result.content_type;
+ }
}
- return _results;
+ if (typeof result.asset !== 'undefined') _results = result.asset;
+ if (typeof result.items !== 'undefined') _results.push(result);
+ }
+ return _results;
}
-export function sendRequest(queryObject, options) {
-
- let env_uid = queryObject.environment_uid;
- if (env_uid) {
- queryObject._query.environment_uid = env_uid;
+export function sendRequest (queryObject, options) {
+ const env_uid = queryObject.environment_uid;
+ if (env_uid) {
+ queryObject._query.environment_uid = env_uid;
+ } else {
+ if (queryObject._query) {
+ queryObject._query.environment = queryObject.environment;
} else {
- if (queryObject._query) {
- queryObject._query.environment = queryObject.environment;
- } else {
- queryObject['_query'] = {};
- queryObject._query['environment'] = queryObject.environment;
- }
+ queryObject._query = {};
+ queryObject._query.environment = queryObject.environment;
}
+ }
- let self = queryObject;
- let cachePolicy = (typeof self.queryCachePolicy !== 'undefined') ? self.queryCachePolicy : self.cachePolicy;
- let tojson = (typeof self.tojson !== 'undefined') ? self.tojson : false;
- let isSingle = (self.entry_uid || self.singleEntry || self.asset_uid) ? true : false;
- let hashQuery = getHash(parseQueryFromParams(self, isSingle, tojson));
+ const self = queryObject;
+ let cachePolicy = (typeof self.queryCachePolicy !== 'undefined') ? self.queryCachePolicy : self.cachePolicy;
+ const tojson = (typeof self.tojson !== 'undefined') ? self.tojson : false;
+ const isSingle = !!((self.entry_uid || self.singleEntry || self.asset_uid));
+ const hashQuery = getHash(parseQueryFromParams(self, isSingle, tojson));
- /**
+ /**
for new api v3
*/
- if (queryObject && queryObject.requestParams && queryObject.requestParams.body && queryObject.requestParams.body.query) {
- let cloneQueryObj = JSON.parse(JSON.stringify(queryObject.requestParams.body.query));
- if (typeof cloneQueryObj !== 'object') {
- cloneQueryObj = JSON.parse(cloneQueryObj);
- }
- delete queryObject.requestParams.body.query;
- queryObject.requestParams.body = merge(queryObject.requestParams.body, cloneQueryObj);
+ if (queryObject && queryObject.requestParams && queryObject.requestParams.body && queryObject.requestParams.body.query) {
+ let cloneQueryObj = JSON.parse(JSON.stringify(queryObject.requestParams.body.query));
+ if (typeof cloneQueryObj !== 'object') {
+ cloneQueryObj = JSON.parse(cloneQueryObj);
+ }
+ delete queryObject.requestParams.body.query;
+ queryObject.requestParams.body = merge(queryObject.requestParams.body, cloneQueryObj);
- if (queryObject.live_preview && queryObject.live_preview.enable === true && queryObject.live_preview.live_preview && queryObject.live_preview.live_preview !== "init") {
- queryObject.requestParams.body = merge(queryObject.requestParams.body, {live_preview: queryObject.live_preview.live_preview || "init"});
- cachePolicy = 2; // network else cache
- if(queryObject.requestParams.body['environment']) {
- delete queryObject.requestParams.body['environment'];
- }
- if(queryObject.requestParams.headers['access_token'])
- delete queryObject.requestParams.headers['access_token'];
- delete queryObject.requestParams.headers['authorization'];
- delete queryObject.requestParams.headers['preview_token'];
+ if (queryObject.live_preview && queryObject.live_preview.enable === true && queryObject.live_preview.live_preview && queryObject.live_preview.live_preview !== 'init') {
+ queryObject.requestParams.body = merge(queryObject.requestParams.body, { live_preview: queryObject.live_preview.live_preview || 'init' });
+ cachePolicy = 2; // network else cache
+ if (queryObject.requestParams.body.environment) {
+ delete queryObject.requestParams.body.environment;
+ }
+ if (queryObject.requestParams.headers.access_token) { delete queryObject.requestParams.headers.access_token; }
+ delete queryObject.requestParams.headers.authorization;
+ delete queryObject.requestParams.headers.preview_token;
- if (queryObject.live_preview.preview_token) {
- queryObject.requestParams.headers['preview_token'] = queryObject.live_preview.preview_token;
- queryObject.requestParams.headers['live_preview'] = queryObject.live_preview.live_preview;
- } else if (queryObject.live_preview.management_token) {
- queryObject.requestParams.headers['authorization'] = queryObject.live_preview.management_token;
- }
- }
+ if (queryObject.live_preview.preview_token) {
+ queryObject.requestParams.headers.preview_token = queryObject.live_preview.preview_token;
+ queryObject.requestParams.headers.live_preview = queryObject.live_preview.live_preview;
+ } else if (queryObject.live_preview.management_token) {
+ queryObject.requestParams.headers.authorization = queryObject.live_preview.management_token;
+ }
}
+ }
- let getCacheCallback = function(resolve, reject) {
- return function(err, entries) {
- try {
- if (err) {
- return reject(err); // Propagate the error to the parent promise
- }
- if (!tojson) entries = resultWrapper(entries);
- resolve(spreadResult(entries)); // Propagate the result to the parent promise
- } catch (e) {
- reject(e); // Handle any synchronous errors
- }
- };
+ const getCacheCallback = function (resolve, reject) {
+ return function (err, entries) {
+ try {
+ if (err) {
+ return reject(err); // Propagate the error to the parent promise
+ }
+ if (!tojson) entries = resultWrapper(entries);
+ resolve(spreadResult(entries)); // Propagate the result to the parent promise
+ } catch (e) {
+ reject(e); // Handle any synchronous errors
+ }
};
-
-
- let callback = function(continueFlag, resolve, reject) {
- if (continueFlag) {
- Request(queryObject, options)
- .then(function(data) {
- try {
- self.entry_uid = self.asset_uid = self.tojson = self.queryCachePolicy = undefined;
- let entries = {};
- let syncstack = {};
- if (queryObject.singleEntry) {
- queryObject.singleEntry = false;
- if (data.schema) entries.schema = data.schema;
- if (data.content_type) {
- entries.content_type = data.content_type;
- delete entries.schema
- }
- if (data.entries && data.entries.length) {
- entries.entry = data.entries[0];
- } else if (data.assets && data.assets.length) {
- entries.assets = data.assets[0];
- } else {
- if (cachePolicy === 2 && self.provider !== null) {
- self.provider.get(hashQuery, function(err, _data) {
- if (err || !_data || (_data.entries.length === 0 && _data.assets.length === 0)) {
- return reject({ error_code: 141, error_message: 'The requested entry doesn\'t exist.' });
- }
- getCacheCallback(resolve, reject)(err, _data);
- });
- return
- } else {
- return reject({ error_code: 141, error_message: 'The requested entry doesn\'t exist.' });
- }
- }
- }
- else if(data.items) {
- syncstack = {
- items : data.items,
- pagination_token : data.pagination_token,
- sync_token : data.sync_token,
- total_count : data.total_count
- }
- } else {
- entries = data;
- }
+ };
- if (cachePolicy !== -1 && self.provider !== null) {
- self.provider.set(hashQuery, entries, function(err) {
- try {
- if (err) reject(err);
- if (!tojson) entries = resultWrapper(entries);
- return resolve(spreadResult(entries));
- } catch (e) {
- return reject(e);
- }
- });
- return resolve(spreadResult(entries));
- }
-
- if(Object.keys(syncstack).length) {
- return resolve(syncstack);
- }
-
- if (!tojson) {
- entries = resultWrapper(entries);
- }
- return resolve(spreadResult(entries));
- } catch (e) {
- return reject({
- message: e.message
- });
+ const callback = function (continueFlag, resolve, reject) {
+ if (continueFlag) {
+ Request(queryObject, options)
+ .then(function (data) {
+ try {
+ self.entry_uid = self.asset_uid = self.tojson = self.queryCachePolicy = undefined;
+ let entries = {};
+ let syncstack = {};
+ if (queryObject.singleEntry) {
+ queryObject.singleEntry = false;
+ if (data.schema) entries.schema = data.schema;
+ if (data.content_type) {
+ entries.content_type = data.content_type;
+ delete entries.schema;
+ }
+ if (data.entries && data.entries.length) {
+ entries.entry = data.entries[0];
+ } else if (data.assets && data.assets.length) {
+ entries.assets = data.assets[0];
+ } else {
+ if (cachePolicy === 2 && self.provider !== null) {
+ self.provider.get(hashQuery, function (err, _data) {
+ if (err || !_data || (_data.entries.length === 0 && _data.assets.length === 0)) {
+ return reject({ error_code: 141, error_message: 'The requested entry doesn\'t exist.' });
}
- }.bind(self))
- .catch(function(error) {
- if(error){
- reject(error);
- }
- else if (cachePolicy === 2 && self.provider !== null) {
- self.provider.get(hashQuery, getCacheCallback(resolve, reject));
- }
- });
-
- }
- }
- switch (cachePolicy) {
- case 1:
- return new Promise(async function(resolve, reject) {
- if (self.provider !== null) {
- await self.provider.get(hashQuery, async function(err, _data) {
- try {
- if (err || !_data) {
- callback(true, resolve, reject);
- } else {
- if (!tojson) {
- _data = resultWrapper(_data);
- }
- return resolve(spreadResult(_data));
- }
- } catch (e) {
- return reject(e);
- }
- });
- }else {
- callback(true, resolve, reject);
+ getCacheCallback(resolve, reject)(err, _data);
+ });
+ return;
+ } else {
+ return reject({ error_code: 141, error_message: 'The requested entry doesn\'t exist.' });
}
+ }
+ } else if (data.items) {
+ syncstack = {
+ items: data.items,
+ pagination_token: data.pagination_token,
+ sync_token: data.sync_token,
+ total_count: data.total_count
+ };
+ } else {
+ entries = data;
+ }
- });
- case 2:
- case 0:
- case undefined:
- case -1:
- return new Promise(function(resolve, reject) {
- callback(true, resolve, reject);
- })
- }
+ if (cachePolicy !== -1 && self.provider !== null) {
+ self.provider.set(hashQuery, entries, function (err) {
+ try {
+ if (err) reject(err);
+ if (!tojson) entries = resultWrapper(entries);
+ return resolve(spreadResult(entries));
+ } catch (e) {
+ return reject(e);
+ }
+ });
+ return resolve(spreadResult(entries));
+ }
- if (cachePolicy === 3) {
+ if (Object.keys(syncstack).length) {
+ return resolve(syncstack);
+ }
- var promise = new Promise(function(resolve, reject) {
- if (self.provider !== null) {
- self.provider.get(hashQuery, function(err, _data) {
- try {
- if (err || !_data) {
- reject(err);
- } else {
- if (!tojson) {
- _data = resultWrapper(_data);
- }
- resolve(spreadResult(_data));
- }
- } catch (e) {
- reject(e);
- }
- });
- }
+ if (!tojson) {
+ entries = resultWrapper(entries);
+ }
+ return resolve(spreadResult(entries));
+ } catch (e) {
+ return reject({
+ message: e.message
});
-
- return promise.then(function() {
- return new Promise(function(resolve, reject) {
- callback(true, resolve, reject);
- });
- }).catch((error) => {
- return new Promise(function(resolve, reject) {
- callback(true, resolve, reject);
- });
- })
+ }
+ })
+ .catch(function (error) {
+ if (error) {
+ reject(error);
+ } else if (cachePolicy === 2 && self.provider !== null) {
+ self.provider.get(hashQuery, getCacheCallback(resolve, reject));
+ }
+ });
}
+ };
+ switch (cachePolicy) {
+ case 1:
+ return new Promise(async function (resolve, reject) {
+ if (self.provider !== null) {
+ await self.provider.get(hashQuery, async function (err, _data) {
+ try {
+ if (err || !_data) {
+ callback(true, resolve, reject);
+ } else {
+ if (!tojson) {
+ _data = resultWrapper(_data);
+ }
+ return resolve(spreadResult(_data));
+ }
+ } catch (e) {
+ return reject(e);
+ }
+ });
+ } else {
+ callback(true, resolve, reject);
+ }
+ });
+ case 2:
+ case 0:
+ case undefined:
+ case -1:
+ return new Promise(function (resolve, reject) {
+ callback(true, resolve, reject);
+ });
+ }
+
+ if (cachePolicy === 3) {
+ const promise = new Promise(function (resolve, reject) {
+ if (self.provider !== null) {
+ self.provider.get(hashQuery, function (err, _data) {
+ try {
+ if (err || !_data) {
+ reject(err);
+ } else {
+ if (!tojson) {
+ _data = resultWrapper(_data);
+ }
+ resolve(spreadResult(_data));
+ }
+ } catch (e) {
+ reject(e);
+ }
+ });
+ }
+ });
+
+ return promise.then(function () {
+ return new Promise(function (resolve, reject) {
+ callback(true, resolve, reject);
+ });
+ }).catch((error) => {
+ return new Promise(function (resolve, reject) {
+ callback(true, resolve, reject);
+ });
+ });
+ }
}
diff --git a/src/core/modules/assets.js b/src/core/modules/assets.js
index 91d8da61..b014db8e 100755
--- a/src/core/modules/assets.js
+++ b/src/core/modules/assets.js
@@ -1,27 +1,27 @@
import * as Utils from '../lib/utils';
/**
- * @class
- Assets
+ * @class
+ Assets
* @summary Creates an instance of `Assets`.
* @description Retrieves all assets of a stack by default. To retrieve a single asset, specify its UID.
* @param {String} uid - uid of asset you want to retrieve
-* @example
+* @example
* let data = Stack.Assets('asset_uid').toJSON().fetch()
* data
* .then(function(result) {
-* // ‘result’ is a single asset object of specified uid
+* // ‘result’ is a single asset object of specified uid
* }, function(error) {
* // error function
* })
-* @example
+* @example
* // Retrieves all assets*
* let data = Stack.Assets().Query().toJSON().find()
* data
* .then(function(result) {
* // All the asset with limit of 100
* // Use skip and limit functions to paginate
-* // ‘result’ will display all assets present in stack
+* // ‘result’ will display all assets present in stack
* }, function(error) {
* // error function
* })
@@ -30,17 +30,17 @@ import * as Utils from '../lib/utils';
*/
export default class Assets {
- constructor() {
- this._query = {};
- this.only = Utils.transform('only');
- return this;
- }
+ constructor () {
+ this._query = {};
+ this.only = Utils.transform('only');
+ return this;
+ }
- /**
+ /**
* Converts your response into plain JavasScript object
* @memberOf Assets
* @example var Query = Stack.ContentType('blog').Query()
- Query
+ Query
.toJSON()
.find()
.then(function (result) {
@@ -51,13 +51,13 @@ export default class Assets {
* @returns {Assets}
* @instance
*/
-
- toJSON() {
- this.tojson = true;
- return this;
- }
-/**
+ toJSON () {
+ this.tojson = true;
+ return this;
+ }
+
+ /**
* Includes query parameters in your queries.
* @memberOf Assets
* @example var data = Stack.Assets(assetUid).addParam('include_dimension', 'true').toJSON().fetch()
@@ -69,17 +69,17 @@ export default class Assets {
* @returns {Assets}
* @instance
*/
-
- addParam(key, value) {
- if (key && typeof key === 'string' && value && typeof value === 'string') {
- this._query[key] = value;
- return this;
- } else {
- if(this.fetchOptions.debug) this.fetchOptions.logHandler('error',"Kindly provide a valid parameters.");
- }
+
+ addParam (key, value) {
+ if (key && typeof key === 'string' && value && typeof value === 'string') {
+ this._query[key] = value;
+ return this;
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'Kindly provide a valid parameters.');
}
+ }
- /**
+ /**
* @method includeFallback
* @memberOf Asset
* @description Include the fallback locale publish content, if specified locale content is not publish.
@@ -87,11 +87,12 @@ export default class Assets {
* @returns {Asset}
* @instance
*/
- includeFallback() {
- this._query['include_fallback'] = true;
- return this;
- }
- /**
+ includeFallback () {
+ this._query.include_fallback = true;
+ return this;
+ }
+
+ /**
* @method includeMetadata
* @memberOf Asset
* @description Include the metadata for getting metadata content for the asset.
@@ -99,38 +100,38 @@ export default class Assets {
* @returns {Asset}
* @instance
*/
- includeMetadata() {
- this._query['include_metadata'] = true;
- return this;
- }
-/**
+ includeMetadata () {
+ this._query.include_metadata = true;
+ return this;
+ }
+ /**
* Fetches a particular asset based on the provided asset UID.
* @memberOf Assets
* @example
* Stack.Assets('assets_uid').toJSON().fetch()
* @example
* Stack.Assets('assets_uid').toJSON().fetch({
- *
+ *
* })
* @returns {promise}
* @instance
*/
- fetch(fetchOptions) {
- if (this.asset_uid) {
- this.requestParams = {
- method: 'POST',
- headers: Utils.mergeDeep({}, this.headers),
- url: this.config.protocol + "://" + this.config.host + ':' + this.config.port + '/' + this.config.version + this.config.urls.assets + this.asset_uid,
- body: {
- _method: 'GET',
- query: this._query
- }
- }
- var options = Utils.mergeDeep(this.fetchOptions, fetchOptions);
- return Utils.sendRequest(Utils.mergeDeep({}, this), options);
- } else {
- if(fetchOptions.debug) fetchOptions.logHandler('error', "Kindly provide an asset uid. e.g. .Assets('asset_uid')");
+ fetch (fetchOptions) {
+ if (this.asset_uid) {
+ this.requestParams = {
+ method: 'POST',
+ headers: Utils.mergeDeep({}, this.headers),
+ url: this.config.protocol + '://' + this.config.host + ':' + this.config.port + '/' + this.config.version + this.config.urls.assets + this.asset_uid,
+ body: {
+ _method: 'GET',
+ query: this._query
}
+ };
+ const options = Utils.mergeDeep(this.fetchOptions, fetchOptions);
+ return Utils.sendRequest(Utils.mergeDeep({}, this), options);
+ } else {
+ if (fetchOptions.debug) fetchOptions.logHandler('error', "Kindly provide an asset uid. e.g. .Assets('asset_uid')");
}
-}
\ No newline at end of file
+ }
+}
diff --git a/src/core/modules/entry.js b/src/core/modules/entry.js
index 644402e0..48de0083 100755
--- a/src/core/modules/entry.js
+++ b/src/core/modules/entry.js
@@ -1,9 +1,9 @@
-import * as Utils from "../lib/utils";
+import * as Utils from '../lib/utils';
/**
- * @class
- Entry
-* @summary Creates an instance of `Entry`.
+ * @class
+ Entry
+* @summary Creates an instance of `Entry`.
* @description An initializer is responsible for creating Entry object.
* @param {String} uid - uid of the entry
* @example
@@ -13,9 +13,9 @@ import * as Utils from "../lib/utils";
*/
export default class Entry {
- constructor() {
- this._query = {};
- /**
+ constructor () {
+ this._query = {};
+ /**
* @method only
* @memberOf Entry
* @description Displays values of only the specified fields of entries or assets in the response
@@ -37,12 +37,12 @@ export default class Entry {
* @example
*
In only, we have the only with a reference parameter with an array, where you need to enter the UID of the reference field in place of "reference_field_uid", and the second parameter with an array of fields to include the data of only the specified array of field_uids for each entry and exclude the data of all other fields.
* Stack.ContentType('contentTypeUid').Query().includeReference('reference_field_uid').only('reference_field_uid', ['title', 'description']).toJSON().find()
- *
+ *
* @returns {Entry}
* @instance
*/
- this.only = Utils.transform('only');
- /**
+ this.only = Utils.transform('only');
+ /**
* @method except
* @memberOf Entry
* @description Displays all data of an entries or assets excluding the data of the specified fields.
@@ -62,33 +62,33 @@ export default class Entry {
* In except, we have the only with a reference parameter with an array, where you need to enter the UID of the reference field in place of "reference_field_uid", and the second parameter with an array of fields to except the data of only the specified array of field_uids for each entry and include the data of all other fields.
* Stack.ContentType('contentTypeUid').Query().includeReference('reference_field_uid').except('reference_field_uid', ['title', 'description']).toJSON().find()
* @returns {Entry}
- * @instance
+ * @instance
*/
- this.except = Utils.transform('except');
- return this;
- }
+ this.except = Utils.transform('except');
+ return this;
+ }
- setCacheProvider(provider) {
- if (provider && typeof provider === 'object') {
- this.provider = provider;
- }
- return this;
+ setCacheProvider (provider) {
+ if (provider && typeof provider === 'object') {
+ this.provider = provider;
}
+ return this;
+ }
- setCachePolicy(policy) {
- if (typeof policy === 'number' && policy >= -1 && policy < 4) {
- if (!this._query) {
- this.cachePolicy = policy;
- } else {
- this.queryCachePolicy = policy;
- }
- } else {
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Kindly provide the valid policy");
- }
- return this;
+ setCachePolicy (policy) {
+ if (typeof policy === 'number' && policy >= -1 && policy < 4) {
+ if (!this._query) {
+ this.cachePolicy = policy;
+ } else {
+ this.queryCachePolicy = policy;
+ }
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'Kindly provide the valid policy');
}
+ return this;
+ }
- /**
+ /**
* @method includeReference
* @memberOf Entry
* @description Fetches the entire content of referenced entry(ies). Read More
@@ -114,7 +114,7 @@ export default class Entry {
})
* @example
* .includeReference with reference_field_uids
- * var Query = Stack.ContentType(contentTypes.source).Query();
+ * var Query = Stack.ContentType(contentTypes.source).Query();
Query
.includeReference('reference_field_uid')
.toJSON()
@@ -125,25 +125,25 @@ export default class Entry {
* @returns {Entry}
* @instance
*/
- includeReference(...val) {
- if (Array.isArray(val) || typeof val === "string") {
- if (arguments.length) {
- for (let i = 0; i < arguments.length; i++) {
- this._query['include'] = this._query['include'] || [];
- this._query['include'] = this._query['include'].concat(arguments[i]);
- }
- }
- return this;
- } else {
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Argument should be a String or an Array.");
+ includeReference (...val) {
+ if (Array.isArray(val) || typeof val === 'string') {
+ if (arguments.length) {
+ for (let i = 0; i < arguments.length; i++) {
+ this._query.include = this._query.include || [];
+ this._query.include = this._query.include.concat(arguments[i]);
}
+ }
+ return this;
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'Argument should be a String or an Array.');
}
+ }
- /**
+ /**
* Sets the language code of which you want to retrieve data.
* @param {String} language_code - language code. e.g. 'en-us', 'ja-jp', etc.
* @memberOf Entry
- * @example
+ * @example
* let data = Stack.ContentType(contentTypeUid).Entry(entryUid).language('ja-jp').fetch()
* data
* .then(function(result) {
@@ -151,20 +151,20 @@ export default class Entry {
* }, function(error) {
* // error function
* })
- *
+ *
* @returns {Entry}
* @instance
*/
- language(language_code) {
- if (language_code && typeof language_code === 'string') {
- this._query['locale'] = language_code;
- return this;
- } else {
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Argument should be a String.");
- }
+ language (language_code) {
+ if (language_code && typeof language_code === 'string') {
+ this._query.locale = language_code;
+ return this;
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'Argument should be a String.');
}
+ }
- /**
+ /**
* @method addQuery
* @memberOf Entry
* @description Adds query to Entry object
@@ -174,16 +174,16 @@ export default class Entry {
* @returns {Entry}
* @instance
*/
- addQuery(key, value) {
- if (key && value && typeof key === 'string') {
- this._query[key] = value;
- return this;
- } else {
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "First argument should be a String.");
- }
+ addQuery (key, value) {
+ if (key && value && typeof key === 'string') {
+ this._query[key] = value;
+ return this;
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'First argument should be a String.');
}
+ }
- /**
+ /**
* @method includeEmbeddedItems
* @memberOf Entry
* @description Include Embedded Objects (Entries and Assets) along with entry/entries details.
@@ -191,12 +191,12 @@ export default class Entry {
* @returns {Entry}
* @instance
*/
- includeEmbeddedItems() {
- this._query['include_embedded_items'] = ["BASE"];
- return this;
- }
+ includeEmbeddedItems () {
+ this._query.include_embedded_items = ['BASE'];
+ return this;
+ }
- /**
+ /**
* @method includeSchema
* @memberOf Entry
* @deprecated since version 3.3.0
@@ -205,17 +205,17 @@ export default class Entry {
* @returns {Entry}
* @instance
*/
- includeSchema() {
- this._query['include_schema'] = true;
- return this;
- }
+ includeSchema () {
+ this._query.include_schema = true;
+ return this;
+ }
- /**
+ /**
* @method includeReferenceContentTypeUid
* @memberOf Entry
* @description This method also includes the content type UIDs of the referenced entries returned in the response.
* @example Stack.ContentType("contentType_uid").Entry("entry_uid").includeReferenceContentTypeUID().fetch()
- * @example
+ * @example
* Query = Stack.ContentType("contentType_uid").Entry("entry_uid").includeReferenceContentTypeUID().fetch()
* Query
* .toJSON()
@@ -227,12 +227,12 @@ export default class Entry {
* @returns {Entry}
* @instance
*/
- includeReferenceContentTypeUID() {
- this._query['include_reference_content_type_uid'] = true;
- return this;
- }
+ includeReferenceContentTypeUID () {
+ this._query.include_reference_content_type_uid = true;
+ return this;
+ }
- /**
+ /**
* @method includeFallback
* @memberOf Entry
* @description Include the fallback locale publish content, if specified locale content is not publish.
@@ -240,12 +240,12 @@ export default class Entry {
* @returns {Entry}
* @instance
*/
- includeFallback() {
- this._query['include_fallback'] = true;
- return this;
- }
+ includeFallback () {
+ this._query.include_fallback = true;
+ return this;
+ }
- /**
+ /**
* @method includeBranch
* @memberOf Entry
* @description Include the Branch for publish content.
@@ -253,12 +253,12 @@ export default class Entry {
* @returns {Entry}
* @instance
*/
- includeBranch() {
- this._query['include_branch'] = true;
- return this;
- }
+ includeBranch () {
+ this._query.include_branch = true;
+ return this;
+ }
- /**
+ /**
* @method includeMetadata
* @memberOf Entry
* @description Include the metadata for getting metadata content for the entry.
@@ -266,12 +266,12 @@ export default class Entry {
* @returns {Entry}
* @instance
*/
- includeMetadata() {
- this._query['include_metadata'] = true;
- return this;
- }
-
- /**
+ includeMetadata () {
+ this._query.include_metadata = true;
+ return this;
+ }
+
+ /**
* @method includeContentType
* @memberOf Entry
* @description Include the details of the content type along with the entry/entries details.
@@ -279,12 +279,12 @@ export default class Entry {
* @returns {Entry}
* @instance
*/
- includeContentType() {
- this._query['include_content_type'] = true;
- return this;
- }
+ includeContentType () {
+ this._query.include_content_type = true;
+ return this;
+ }
- /**
+ /**
* @method includeOwner
* @memberOf Entry
* @description Include the owner details along with the entry/entries details.
@@ -293,15 +293,15 @@ export default class Entry {
* @deprecated The includeOwner function is deprecated.
* @instance
*/
- includeOwner() {
- console.warn("The includeOwner function is deprecated.")
- this._query['include_owner'] = true;
- return this;
- }
+ includeOwner () {
+ console.warn('The includeOwner function is deprecated.');
+ this._query.include_owner = true;
+ return this;
+ }
- /**
+ /**
* @method toJSON
- * @memberOf Entry
+ * @memberOf Entry
* @description Converts your response into plain JavasScript object.Supports both entry and asset queries.
* @example
* Query = Stack.ContentType(contentTypeUid).Entry(entryUid).fetch()
@@ -315,14 +315,14 @@ export default class Entry {
* @returns {Entry}
* @instance
*/
- toJSON() {
- this.tojson = true;
- return this;
- }
+ toJSON () {
+ this.tojson = true;
+ return this;
+ }
- /**
+ /**
* @method addParam
- * @memberOf Entry
+ * @memberOf Entry
* @description Includes query parameters in your queries.
* @example var data = Stack.ContentType(contentTypeUid).Entry(entryUid).addParam('include_count', 'true').fetch()
* data.then(function (result) {
@@ -333,65 +333,65 @@ export default class Entry {
* @returns {Entry}
* @instance
*/
- addParam(key, value) {
- if (key && value && typeof key === 'string' && typeof value === 'string') {
- this._query[key] = value;
- return this;
- } else {
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Kindly provide valid parameters.");
- }
+ addParam (key, value) {
+ if (key && value && typeof key === 'string' && typeof value === 'string') {
+ this._query[key] = value;
+ return this;
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'Kindly provide valid parameters.');
}
+ }
- /**
+ /**
* @method Variants
* @memberOf Entry
- * @param {String} uid - uid of the variants entry
+ * @param {String} uid - uid of the variants entry
* @description An initializer is responsible for creating Variants Entry object
* @returns {Variants}
- * @instance
+ * @instance
*/
- variants(variant_headers) {
- if (Array.isArray(variant_headers) && variant_headers.length > 0) {
- this.headers['x-cs-variant-uid'] = variant_headers.join(',')
- }else{
- this.headers['x-cs-variant-uid'] = variant_headers;
- }
- return this;
- }
+ variants (variant_headers) {
+ if (Array.isArray(variant_headers) && variant_headers.length > 0) {
+ this.headers['x-cs-variant-uid'] = variant_headers.join(',');
+ } else {
+ this.headers['x-cs-variant-uid'] = variant_headers;
+ }
+ return this;
+ }
- /**
+ /**
* @method fetch
- * @memberOf Entry
+ * @memberOf Entry
* @description Fetches a particular entry based on the provided entry UID.
* @example
* Stack.ContentType(contentTypeUid).Entry(entryUid).toJSON().fetch()
- *
+ *
* @example
* Stack.ContentType(contentTypeUid).Entry(entryUid).toJSON().fetch({
- *
+ *
* })
* @returns {promise}
* @instance
*/
- fetch(fetchOptions) {
- var host = this.config.host + ':' + this.config.port
- if(this.live_preview && this.live_preview.enable === true && this.live_preview.live_preview && this.live_preview.live_preview !== "init" ) {
- host = this.live_preview.host
- }
- if (this.entry_uid) {
- this.requestParams = {
- method: 'POST',
- headers: Utils.mergeDeep({}, this.headers),
- url: this.config.protocol + "://" + host + '/' + this.config.version + this.config.urls.content_types + this.content_type_uid + this.config.urls.entries + this.entry_uid,
- body: {
- _method: 'GET',
- query: this._query
- }
- };
- var options = Utils.mergeDeep(this.fetchOptions, fetchOptions);
- return Utils.sendRequest(Utils.mergeDeep({}, this), options);
- } else {
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Kindly provide an entry uid. e.g. .Entry('asset_uid')");
+ fetch (fetchOptions) {
+ let host = this.config.host + ':' + this.config.port;
+ if (this.live_preview && this.live_preview.enable === true && this.live_preview.live_preview && this.live_preview.live_preview !== 'init') {
+ host = this.live_preview.host;
+ }
+ if (this.entry_uid) {
+ this.requestParams = {
+ method: 'POST',
+ headers: Utils.mergeDeep({}, this.headers),
+ url: this.config.protocol + '://' + host + '/' + this.config.version + this.config.urls.content_types + this.content_type_uid + this.config.urls.entries + this.entry_uid,
+ body: {
+ _method: 'GET',
+ query: this._query
}
+ };
+ const options = Utils.mergeDeep(this.fetchOptions, fetchOptions);
+ return Utils.sendRequest(Utils.mergeDeep({}, this), options);
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Kindly provide an entry uid. e.g. .Entry('asset_uid')");
}
+ }
}
diff --git a/src/core/modules/query.js b/src/core/modules/query.js
index f81738dd..77c60030 100755
--- a/src/core/modules/query.js
+++ b/src/core/modules/query.js
@@ -2,79 +2,79 @@ import * as Utils from '../lib/utils.js';
import Entry from './entry';
const _extend = {
- compare: function(type) {
- return function(key, value) {
- if (key && value && typeof key === 'string' && typeof value !== 'undefined') {
- this._query['query'][key] = this._query['query']['file_size'] || {};
- this._query['query'][key][type] = value;
- return this;
- } else {
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Kindly provide valid parameters.");
- }
- };
- },
- contained: function(bool) {
- let type = (bool) ? '$in' : '$nin';
- return function(key, value) {
- if (key && value && typeof key === 'string' && Array.isArray(value)) {
- this._query['query'][key] = this._query['query'][key] || {};
- this._query['query'][key][type] = this._query['query'][key][type] || [];
- this._query['query'][key][type] = this._query['query'][key][type].concat(value);
- return this;
- } else {
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Kindly provide valid parameters.");
- }
- };
- },
- exists: function(bool) {
- return function(key) {
- if (key && typeof key === 'string') {
- this._query['query'][key] = this._query['query'][key] || {};
- this._query['query'][key]['$exists'] = bool;
- return this;
- } else {
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Kindly provide valid parameters.");
- }
- };
- },
- logical: function(type) {
- return function() {
- let _query = [];
- for (let i = 0, _i = arguments.length; i < _i; i++) {
- if (arguments[i] instanceof Query && arguments[i]._query.query) {
- _query.push(arguments[i]._query.query);
- } else if (typeof arguments[i] === "object") {
- _query.push(arguments[i]);
- }
- }
- if (this._query['query'][type]) {
- this._query['query'][type] = this._query['query'][type].concat(_query);
- } else {
- this._query['query'][type] = _query;
- }
- return this;
- };
- },
- sort: function(type) {
- return function(key) {
- if (key && typeof key === 'string') {
- this._query[type] = key;
- return this;
- } else {
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Argument should be a string.");
- }
- };
- },
- pagination: function(type) {
- return function(value) {
- if (typeof value === 'number') {
- this._query[type] = value;
- return this;
- } else {
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Argument should be a number.");
- }
+ compare: function (type) {
+ return function (key, value) {
+ if (key && value && typeof key === 'string' && typeof value !== 'undefined') {
+ this._query.query[key] = this._query.query.file_size || {};
+ this._query.query[key][type] = value;
+ return this;
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'Kindly provide valid parameters.');
+ }
+ };
+ },
+ contained: function (bool) {
+ const type = (bool) ? '$in' : '$nin';
+ return function (key, value) {
+ if (key && value && typeof key === 'string' && Array.isArray(value)) {
+ this._query.query[key] = this._query.query[key] || {};
+ this._query.query[key][type] = this._query.query[key][type] || [];
+ this._query.query[key][type] = this._query.query[key][type].concat(value);
+ return this;
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'Kindly provide valid parameters.');
+ }
+ };
+ },
+ exists: function (bool) {
+ return function (key) {
+ if (key && typeof key === 'string') {
+ this._query.query[key] = this._query.query[key] || {};
+ this._query.query[key].$exists = bool;
+ return this;
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'Kindly provide valid parameters.');
+ }
+ };
+ },
+ logical: function (type) {
+ return function () {
+ const _query = [];
+ for (let i = 0, _i = arguments.length; i < _i; i++) {
+ if (arguments[i] instanceof Query && arguments[i]._query.query) {
+ _query.push(arguments[i]._query.query);
+ } else if (typeof arguments[i] === 'object') {
+ _query.push(arguments[i]);
}
- }
+ }
+ if (this._query.query[type]) {
+ this._query.query[type] = this._query.query[type].concat(_query);
+ } else {
+ this._query.query[type] = _query;
+ }
+ return this;
+ };
+ },
+ sort: function (type) {
+ return function (key) {
+ if (key && typeof key === 'string') {
+ this._query[type] = key;
+ return this;
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'Argument should be a string.');
+ }
+ };
+ },
+ pagination: function (type) {
+ return function (value) {
+ if (typeof value === 'number') {
+ this._query[type] = value;
+ return this;
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'Argument should be a number.');
+ }
+ };
+ }
};
/**
@@ -83,26 +83,26 @@ const _extend = {
* @param {Object} this `this` variable from Query class
* @return {string} returns the url that will be used to make API calls
*/
-function getRequestUrl(type, config, content_type_uid, baseURL) {
- let url;
- switch(type) {
- case 'asset':
- url = baseURL + config.urls.assets;
- break;
- case 'taxonomy':
- url = baseURL + config.urls.taxonomies;
- break;
- case 'contentType':
- default:
- url = baseURL + config.urls.content_types + content_type_uid + config.urls.entries;
- break;
- }
- return url;
+function getRequestUrl (type, config, content_type_uid, baseURL) {
+ let url;
+ switch (type) {
+ case 'asset':
+ url = baseURL + config.urls.assets;
+ break;
+ case 'taxonomy':
+ url = baseURL + config.urls.taxonomies;
+ break;
+ case 'contentType':
+ default:
+ url = baseURL + config.urls.content_types + content_type_uid + config.urls.entries;
+ break;
+ }
+ return url;
}
/**
- * @class
- Query
+ * @class
+ Query
* @description
* An initializer is responsible for creating Query object.Provides support for all search queries
* @example
@@ -112,12 +112,11 @@ function getRequestUrl(type, config, content_type_uid, baseURL) {
* @returns {Query}
*/
export default class Query extends Entry {
-
- constructor() {
- super();
- this._query = this._query || {};
- this._query['query'] = this._query['query'] || {};
- /**
+ constructor () {
+ super();
+ this._query = this._query || {};
+ this._query.query = this._query.query || {};
+ /**
* @method lessThan
* @memberOf Query
* @description Retrieves entries in which the value of a field is lesser than the provided value
@@ -133,9 +132,9 @@ export default class Query extends Entry {
* @returns {Query}
* @instance
*/
- this.lessThan = _extend.compare('$lt');
+ this.lessThan = _extend.compare('$lt');
- /**
+ /**
* @method lessThanOrEqualTo
* @memberOf Query
* @description Retrieves entries in which the value of a field is lesser than or equal to the provided value.
@@ -151,14 +150,14 @@ export default class Query extends Entry {
* @returns {Query}
* @instance
*/
- this.lessThanOrEqualTo = _extend.compare('$lte');
- /**
+ this.lessThanOrEqualTo = _extend.compare('$lte');
+ /**
* @method greaterThan
* @memberOf Query
* @description Retrieves entries in which the value for a field is greater than the provided value.
* @param {String} key - uid of the field
* @param {*} value - value used to match or compare
- * @example
+ * @example
* let blogQuery = Stack().ContentType('example').Query();
* let data = blogQuery.greaterThan('created_at','2015-03-12').find()
* data.then(function(result) {
@@ -169,13 +168,13 @@ export default class Query extends Entry {
* @returns {Query}
* @instance
*/
- this.greaterThan = _extend.compare('$gt');
+ this.greaterThan = _extend.compare('$gt');
- /**
+ /**
* @method greaterThanOrEqualTo
* @memberOf Query
* @description Retrieves entries in which the value for a field is greater than or equal to the provided value.
- * @param {String} key - uid of the field
+ * @param {String} key - uid of the field
* @param {*} value - Value used to match or compare
* @example let blogQuery = Stack().ContentType('example').Query();
* let data = blogQuery.greaterThanOrEqualTo('created_at','2015-03-12').find()
@@ -187,13 +186,13 @@ export default class Query extends Entry {
* @returns {Query}
* @instance
*/
- this.greaterThanOrEqualTo = _extend.compare('$gte');
+ this.greaterThanOrEqualTo = _extend.compare('$gte');
- /**
+ /**
* @method notEqualTo
* @memberOf Query
* @description Retrieves entries in which the value for a field does not match the provided value.
- * @param {String} key - uid of the field
+ * @param {String} key - uid of the field
* @param {*} value - Value used to match or compare
* @example let blogQuery = Stack().ContentType('example').Query();
* let data = blogQuery.notEqualTo('title','Demo').find()
@@ -205,9 +204,9 @@ export default class Query extends Entry {
* @returns {Query}
* @instance
*/
- this.notEqualTo = _extend.compare('$ne');
+ this.notEqualTo = _extend.compare('$ne');
- /**
+ /**
* @method containedIn
* @memberOf Query
* @description Retrieve entries in which the value of a field matches with any of the provided array of values
@@ -223,9 +222,9 @@ export default class Query extends Entry {
* @returns {Query}
* @instance
*/
- this.containedIn = _extend.contained(true);
+ this.containedIn = _extend.contained(true);
- /**
+ /**
* @method notContainedIn
* @memberOf Query
* @description Retrieve entries in which the value of a field does not match with any of the provided array of values.
@@ -241,10 +240,10 @@ export default class Query extends Entry {
* @returns {Query}
* @instance
*/
- this.notContainedIn = _extend.contained(false);
+ this.notContainedIn = _extend.contained(false);
- /**
- * @method exists
+ /**
+ * @method exists
* @memberOf Query
* @description Retrieve entries if value of the field, mentioned in the condition, exists.
* @param {String} key - uid of the field
@@ -259,9 +258,9 @@ export default class Query extends Entry {
* @returns {Query}
* @instance
*/
- this.exists = _extend.exists(true);
+ this.exists = _extend.exists(true);
- /**
+ /**
* @method notExists
* @memberOf Query
* @description Retrieve entries if value of the field, mentioned in the condition, does not exists.
@@ -277,9 +276,9 @@ export default class Query extends Entry {
* @returns {Query}
* @instance
*/
- this.notExists = _extend.exists(false);
+ this.notExists = _extend.exists(false);
- /**
+ /**
* @method ascending
* @memberOf Query
* @description Sort fetched entries in the ascending order with respect to a specific field.
@@ -287,16 +286,16 @@ export default class Query extends Entry {
* @example let blogQuery = Stack().ContentType('example').Query();
* let data = blogQuery.ascending('created_at').find()
* data.then(function(result) {
- * // ‘result’ contains the list of entries which is sorted in ascending order on the basis of ‘created_at’.
+ * // ‘result’ contains the list of entries which is sorted in ascending order on the basis of ‘created_at’.
* },function (error) {
* // error function
* })
* @returns {Query}
* @instance
*/
- this.ascending = _extend.sort('asc');
+ this.ascending = _extend.sort('asc');
- /**
+ /**
* @method descending
* @memberOf Query
* @description Sort fetched entries in the descending order with respect to a specific field
@@ -304,16 +303,16 @@ export default class Query extends Entry {
* @example let blogQuery = Stack().ContentType('example').Query();
* let data = blogQuery.descending('created_at').find()
* data.then(function(result) {
- * // ‘result’ contains the list of entries which is sorted in descending order on the basis of ‘created_at’.
+ * // ‘result’ contains the list of entries which is sorted in descending order on the basis of ‘created_at’.
* },function (error) {
* // error function
* })
* @returns {Query}
* @instance
*/
- this.descending = _extend.sort('desc');
+ this.descending = _extend.sort('desc');
- /**
+ /**
* @method beforeUid
* @memberOf Query
* @description Sort fetched entries in the descending order with respect to a specific field
@@ -322,9 +321,9 @@ export default class Query extends Entry {
* @returns {Query}
* @instance
*/
- this.beforeUid = _extend.sort('before_uid');
+ this.beforeUid = _extend.sort('before_uid');
- /**
+ /**
* @method afterUid
* @memberOf Query
* @description This method provides only the entries after the specified entry id.
@@ -333,9 +332,9 @@ export default class Query extends Entry {
* @returns {Query}
* @instance
*/
- this.afterUid = _extend.sort('after_uid');
+ this.afterUid = _extend.sort('after_uid');
- /**
+ /**
* @method skip
* @memberOf Query
* @description Skips at specific number of entries.
@@ -344,16 +343,16 @@ export default class Query extends Entry {
* @example let blogQuery = Stack().ContentType('example').Query();
* let data = blogQuery.skip(5).find()
* data.then(function(result) {
- * // result contains the list of data which is sorted in descending order on 'created_at' bases.
+ * // result contains the list of data which is sorted in descending order on 'created_at' bases.
* },function (error) {
* // error function
* })
* @returns {Query}
* @instance
*/
- this.skip = _extend.pagination('skip');
+ this.skip = _extend.pagination('skip');
- /**
+ /**
* @method limit
* @memberOf Query
* @description Returns a specific number of entries based on the set limit
@@ -368,9 +367,9 @@ export default class Query extends Entry {
* @returns {Query}
* @instance
*/
- this.limit = _extend.pagination('limit');
+ this.limit = _extend.pagination('limit');
- /**
+ /**
* @method or
* @memberOf Query
* @description Retrieves entries that satisfy at least one of the given conditions
@@ -388,9 +387,9 @@ export default class Query extends Entry {
* @returns {Query}
* @instance
*/
- this.or = _extend.logical('$or');
+ this.or = _extend.logical('$or');
- /**
+ /**
* @method and
* @memberOf Query
* @description Retrieve entries that satisfy all the provided conditions.
@@ -408,21 +407,20 @@ export default class Query extends Entry {
* @returns {Query}
* @instance
*/
- this.and = _extend.logical('$and');
- }
+ this.and = _extend.logical('$and');
+ }
-
- equalTo(key, value) {
- if (key && typeof key === 'string') {
- this._query['query'][key] = value;
+ equalTo (key, value) {
+ if (key && typeof key === 'string') {
+ this._query.query[key] = value;
- return this;
- } else {
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Kindly provide valid parameters.");
- }
+ return this;
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'Kindly provide valid parameters.');
}
+ }
- /**
+ /**
* @method where
* @memberOf Query
* @description Retrieve entries in which a specific field satisfies the value provided
@@ -431,7 +429,7 @@ export default class Query extends Entry {
* @example let blogQuery = Stack().ContentType('example').Query();
* let data = blogQuery.where('title','Demo').find()
* data.then(function(result) {
- * // ‘result’ contains the list of entries where value of ‘title’ is equal to ‘Demo’.
+ * // ‘result’ contains the list of entries where value of ‘title’ is equal to ‘Demo’.
* },function (error) {
* // error function
* })
@@ -439,16 +437,16 @@ export default class Query extends Entry {
* @instance
*/
- where(key, value) {
- if (key && typeof key === 'string') {
- this._query['query'][key] = value;
- return this;
- } else {
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Kindly provide valid parameters.");
- }
+ where (key, value) {
+ if (key && typeof key === 'string') {
+ this._query.query[key] = value;
+ return this;
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'Kindly provide valid parameters.');
}
+ }
- /**
+ /**
* @method count
* @memberOf Query
* @description Returns the total number of entries
@@ -456,142 +454,141 @@ export default class Query extends Entry {
* @example let blogQuery = Stack().ContentType('example').Query();
* let data = blogQuery.count().find()
* data.then(function(result) {
- * // ‘result’ contains the total count.
+ * // ‘result’ contains the total count.
* },function (error) {
* // error function
* })
* @returns {Query}
* @instance
*/
- count() {
- const host = this.config.protocol + "://" + this.config.host + ':' + this.config.port + '/' + this.config.version,
- url = getRequestUrl(this.type, this.config, this.content_type_uid, host);
- this._query['count'] = true;
- this.requestParams = {
- method: 'POST',
- headers: Utils.mergeDeep({}, this.headers),
- url: url,
- body: {
- _method: 'GET',
- query: this._query
- }
- };
- return this;
- }
-
- /**
+ count () {
+ const host = this.config.protocol + '://' + this.config.host + ':' + this.config.port + '/' + this.config.version;
+ const url = getRequestUrl(this.type, this.config, this.content_type_uid, host);
+ this._query.count = true;
+ this.requestParams = {
+ method: 'POST',
+ headers: Utils.mergeDeep({}, this.headers),
+ url,
+ body: {
+ _method: 'GET',
+ query: this._query
+ }
+ };
+ return this;
+ }
+
+ /**
* @method query
* @memberOf Query
* @description Retrieve entries based on raw queries
- * @param {object} query - RAW (JSON) queries
+ * @param {object} query - RAW (JSON) queries
* @returns {Query}
* @instance
- * @example
+ * @example
* let blogQuery = Stack().ContentType('example').Query();
* let data = blogQuery.query({"brand": {"$nin_query": {"title": "Apple Inc."}}}).find()
* data.then(function(result) {
- * // ‘result’ contains the total count.
+ * // ‘result’ contains the total count.
* },function (error) {
* // error function
* })
*/
- query(query) {
- if (typeof query === "object") {
- this._query['query'] = Utils.mergeDeep(this._query['query'], query);
- return this;
- } else {
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Kindly provide valid parameters");
- }
+ query (query) {
+ if (typeof query === 'object') {
+ this._query.query = Utils.mergeDeep(this._query.query, query);
+ return this;
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'Kindly provide valid parameters');
}
+ }
- /**
+ /**
* @method referenceIn
* @memberOf Query
* @description Retrieve entries that satisfy the query conditions made on referenced fields.
- * @param {Query} query - RAW (JSON) queries
+ * @param {Query} query - RAW (JSON) queries
* @returns {Query}
* @instance
- * @example
+ * @example
* referenceIn with Query instances
* let blogQuery = Stack().ContentType('example').Query();
* let Query = Stack.ContentType('blog').Query().where('title', 'Demo')
* let data = blogQuery.referenceIn("brand", Query).find()
* data.then(function(result) {
- * // ‘result’ contains the total count.
+ * // ‘result’ contains the total count.
* },function (error) {
* // error function
* })
- *
- * @example
+ *
+ * @example
* referenceIn with raw queries
* let blogQuery = Stack().ContentType('example').Query();
* let data = blogQuery.referenceIn("brand", {'title': 'Demo'}).find()
* data.then(function(result) {
- * // ‘result’ contains the total count.
+ * // ‘result’ contains the total count.
* },function (error) {
* // error function
* })
*/
- referenceIn(key, query) {
- var _query = {}
- if (query instanceof Query && query._query.query) {
- _query["$in_query"] = query._query.query;
- } else if (typeof query === "object") {
- _query["$in_query"] = query;
- }
- if (this._query['query'][key]) {
- this._query['query'][key] = this._query['query'][key].concat(_query);
- } else {
- this._query['query'][key] = _query;
- }
- return this;
+ referenceIn (key, query) {
+ const _query = {};
+ if (query instanceof Query && query._query.query) {
+ _query.$in_query = query._query.query;
+ } else if (typeof query === 'object') {
+ _query.$in_query = query;
}
+ if (this._query.query[key]) {
+ this._query.query[key] = this._query.query[key].concat(_query);
+ } else {
+ this._query.query[key] = _query;
+ }
+ return this;
+ }
-
- /**
+ /**
* @method referenceNotIn
* @memberOf Query
* @description Retrieve entries that does not satisfy the query conditions made on referenced fields.
- * @param {Query} query - RAW (JSON) queries
+ * @param {Query} query - RAW (JSON) queries
* @returns {Query}
* @instance
- * @example
+ * @example
* referenceNotIn with Query instances
* let blogQuery = Stack().ContentType('example').Query();
* let data = blogQuery.referenceNotIn("brand", {'title': 'Demo'}).find()
* data.then(function(result) {
- * // ‘result’ contains the total count.
+ * // ‘result’ contains the total count.
* },function (error) {
* // error function
* })
- *
- * @example
+ *
+ * @example
* referenceNotIn with raw queries
* let blogQuery = Stack().ContentType('example').Query();
* let Query = Stack.ContentType('blog').Query().where('title', 'Demo')
* let data = blogQuery.referenceNotIn("brand", Query).find()
* data.then(function(result) {
- * // ‘result’ contains the total count.
+ * // ‘result’ contains the total count.
* },function (error) {
* // error function
* })
*/
- referenceNotIn(key, query) {
- var _query = {}
- if (query instanceof Query && query._query.query) {
- _query["$nin_query"] = query._query.query;
- } else if (typeof query === "object") {
- _query["$nin_query"] = query;
- }
- if (this._query['query'][key]) {
- this._query['query'][key] = this._query['query'][key].concat(_query);
- } else {
- this._query['query'][key] = _query;
- }
- return this;
+ referenceNotIn (key, query) {
+ const _query = {};
+ if (query instanceof Query && query._query.query) {
+ _query.$nin_query = query._query.query;
+ } else if (typeof query === 'object') {
+ _query.$nin_query = query;
}
+ if (this._query.query[key]) {
+ this._query.query[key] = this._query.query[key].concat(_query);
+ } else {
+ this._query.query[key] = _query;
+ }
+ return this;
+ }
- /**
+ /**
* @method tags
* @memberOf Query
* @description Retrieves entries based on the provided tags
@@ -606,38 +603,37 @@ export default class Query extends Entry {
* @returns {Query}
* @instance
*/
- tags(values) {
- if (Array.isArray(values)) {
- this._query['tags'] = values;
- return this;
- } else {
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Kindly provide valid parameters");
- }
+ tags (values) {
+ if (Array.isArray(values)) {
+ this._query.tags = values;
+ return this;
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'Kindly provide valid parameters');
}
+ }
- /**
+ /**
* @method includeReferenceContentTypeUid
* @memberOf Query
* @description This method also includes the content type UIDs of the referenced entries returned in the response.
* @example Stack.ContentType("contentType_uid").Query().includeReferenceContentTypeUID().find()
- * @example
+ * @example
* let blogQuery = Stack.ContentType("contentType_uid").Query();
* let data = blogQuery.includeReferenceContentTypeUID().find()
* data.then(function(result) {
- * // ‘result’ contains a list of entries in which content type UIDs is present.
+ * // ‘result’ contains a list of entries in which content type UIDs is present.
* },function (error) {
* // error function
* })
* @returns {Query}
* @instance
*/
- includeReferenceContentTypeUID() {
- this._query['include_reference_content_type_uid'] = true;
- return this;
- }
-
+ includeReferenceContentTypeUID () {
+ this._query.include_reference_content_type_uid = true;
+ return this;
+ }
- /**
+ /**
* @method includeCount
* @memberOf Query
* @description Includes the total number of entries returned in the response.
@@ -645,19 +641,19 @@ export default class Query extends Entry {
* @example let blogQuery = Stack().ContentType('example').Query();
* let data = blogQuery.includeCount().find()
* data.then(function(result) {
- * // ‘result’ contains a list of entries in which count of object is present at array[1] position.
+ * // ‘result’ contains a list of entries in which count of object is present at array[1] position.
* },function (error) {
* // error function
* })
* @returns {Query}
* @instance
*/
- includeCount() {
- this._query['include_count'] = true;
- return this;
- }
+ includeCount () {
+ this._query.include_count = true;
+ return this;
+ }
- /**
+ /**
* @method addParam
* @description Includes query parameters in your queries.
* @memberOf Query
@@ -670,16 +666,16 @@ export default class Query extends Entry {
* @returns {Query}
* @instance
*/
- addParam(key, value) {
- if (key && value && typeof key === 'string' && typeof value === 'string') {
- this._query[key] = value;
- return this;
- } else {
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Kindly provide valid parameters.");
- }
+ addParam (key, value) {
+ if (key && value && typeof key === 'string' && typeof value === 'string') {
+ this._query[key] = value;
+ return this;
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'Kindly provide valid parameters.');
}
+ }
- /**
+ /**
* @method getQuery
* @memberOf Query
* @description Returns the raw (JSON) query based on the filters applied on Query object.
@@ -687,11 +683,11 @@ export default class Query extends Entry {
* @returns {Query}
* @instance
*/
- getQuery() {
- return this._query.query || {};
- }
+ getQuery () {
+ return this._query.query || {};
+ }
- /**
+ /**
* @method regex
* @memberOf Query
* @description Retrieve entries that match the provided regular expressions
@@ -707,19 +703,19 @@ export default class Query extends Entry {
* @returns {Query}
* @instance
*/
- regex(key, value, options) {
- if (key && value && typeof key === 'string' && typeof value === 'string') {
- this._query['query'][key] = {
- $regex: value
- };
- if (options) this._query['query'][key]['$options'] = options;
- return this;
- } else {
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Kindly provide valid parameters.");
- }
+ regex (key, value, options) {
+ if (key && value && typeof key === 'string' && typeof value === 'string') {
+ this._query.query[key] = {
+ $regex: value
+ };
+ if (options) this._query.query[key].$options = options;
+ return this;
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'Kindly provide valid parameters.');
}
+ }
- /**
+ /**
* @method search
* @memberOf Query
* @deprecated since version 3.15.0
@@ -735,33 +731,33 @@ export default class Query extends Entry {
* })
* @returns {Query}
* @instance
- */
- search(value) {
- if (value && typeof value === 'string') {
- this._query['typeahead'] = value;
- return this;
- } else {
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Kindly provide valid parameters.");
- }
+ */
+ search (value) {
+ if (value && typeof value === 'string') {
+ this._query.typeahead = value;
+ return this;
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'Kindly provide valid parameters.');
}
+ }
- /**
+ /**
* @method find
* @memberOf Query
* @description Retrieves entries that satisfied the specified query
* @example let blogQuery = Stack().ContentType('example').Query().find();
* blogQuery.then(function(result) {
- * // result contains the list of object.
+ * // result contains the list of object.
* },function (error) {
* // error function
* })
* blogQuery.find()
* @example
* let blogQuery = Stack.ContentType(contentTypeUid).Query().find({
- *
+ *
* });
* blogQuery.then(function(result) {
- * // result contains the list of object.
+ * // result contains the list of object.
* },function (error) {
* // error function
* })
@@ -769,52 +765,52 @@ export default class Query extends Entry {
* @returns {promise}
* @instance
*/
- find(fetchOptions) {
- var host = this.config.host + ':' + this.config.port
- if (this.type && this.type !== 'asset' && this.live_preview && this.live_preview.enable === true && this.live_preview.live_preview && this.live_preview.live_preview !== "init") {
- host = this.live_preview.host;
- }
- const baseURL = this.config.protocol + "://" + host + '/' + this.config.version
- const url = getRequestUrl(this.type, this.config, this.content_type_uid, baseURL)
-
-
- this.requestParams = {
- method: 'POST',
- headers: Utils.mergeDeep({}, this.headers),
- url: url,
- body: {
- _method: 'GET',
- query: this._query
- }
- };
- var options = Utils.mergeDeep(this.fetchOptions, fetchOptions);
- return Utils.sendRequest(Utils.mergeDeep({}, this), options);
+ find (fetchOptions) {
+ let host = this.config.host + ':' + this.config.port;
+ if (this.type && this.type !== 'asset' && this.live_preview && this.live_preview.enable === true && this.live_preview.live_preview && this.live_preview.live_preview !== 'init') {
+ host = this.live_preview.host;
}
- /**
+ const baseURL = this.config.protocol + '://' + host + '/' + this.config.version;
+ const url = getRequestUrl(this.type, this.config, this.content_type_uid, baseURL);
+
+ this.requestParams = {
+ method: 'POST',
+ headers: Utils.mergeDeep({}, this.headers),
+ url,
+ body: {
+ _method: 'GET',
+ query: this._query
+ }
+ };
+ const options = Utils.mergeDeep(this.fetchOptions, fetchOptions);
+ return Utils.sendRequest(Utils.mergeDeep({}, this), options);
+ }
+
+ /**
* @method Variants
* @memberOf Query
- * @param {String} uid - uid of the variants entry
+ * @param {String} uid - uid of the variants entry
* @description An initializer is responsible for creating Variants Entry object
* @returns {Variants}
- * @instance
+ * @instance
*/
- variants(variant_headers) {
- if (Array.isArray(variant_headers) && variant_headers.length > 0) {
- this.headers['x-cs-variant-uid'] = variant_headers.join(',')
- }else{
- this.headers['x-cs-variant-uid'] = variant_headers;
- }
- return this;
+ variants (variant_headers) {
+ if (Array.isArray(variant_headers) && variant_headers.length > 0) {
+ this.headers['x-cs-variant-uid'] = variant_headers.join(',');
+ } else {
+ this.headers['x-cs-variant-uid'] = variant_headers;
}
+ return this;
+ }
- /**
+ /**
* @method findOne
* @memberOf Query
* @deprecated since version 3.3.0
* @description Retrieve a single entry from the result
* @example let blogQuery = Stack().ContentType('example').Query().findOne();
* blogQuery.then(function(result) {
- * // result contains the single item object.
+ * // result contains the single item object.
* },function (error) {
* // error function
* })
@@ -822,34 +818,34 @@ export default class Query extends Entry {
* @returns {promise}
* @instance
*/
- findOne() {
- let host = this.config.protocol + "://" + this.config.host + ':' + this.config.port + '/' + this.config.version
- if(this.type && this.type !== 'asset' && this.live_preview && this.live_preview.enable === true && this.live_preview.live_preview && this.live_preview.live_preview !== "init" ) {
- host = this.config.protocol + "://" + this.live_preview.host + '/' + this.config.version
- }
- const url = getRequestUrl(this.type, this.config, this.content_type_uid, host)
- this.singleEntry = true;
- this._query.limit = 1;
- this.requestParams = {
- method: 'POST',
- headers: Utils.mergeDeep({}, this.headers),
- url: url,
- body: {
- _method: 'GET',
- query: this._query
- }
- };
- const options = Utils.mergeDeep({}, this.fetchOptions);
- return Utils.sendRequest(Utils.mergeDeep({}, this), options).catch(error => {
- // Add HTTP status code to the error object if it exists
- if (error.status) {
- return Promise.reject({
- ...error,
- http_code: error.status, // Adding the HTTP status code explicitly
- http_message: error.statusText || 'An error occurred'
- });
- }
- return Promise.reject(error); // Fallback for other errors
- });
+ findOne () {
+ let host = this.config.protocol + '://' + this.config.host + ':' + this.config.port + '/' + this.config.version;
+ if (this.type && this.type !== 'asset' && this.live_preview && this.live_preview.enable === true && this.live_preview.live_preview && this.live_preview.live_preview !== 'init') {
+ host = this.config.protocol + '://' + this.live_preview.host + '/' + this.config.version;
}
-}
\ No newline at end of file
+ const url = getRequestUrl(this.type, this.config, this.content_type_uid, host);
+ this.singleEntry = true;
+ this._query.limit = 1;
+ this.requestParams = {
+ method: 'POST',
+ headers: Utils.mergeDeep({}, this.headers),
+ url,
+ body: {
+ _method: 'GET',
+ query: this._query
+ }
+ };
+ const options = Utils.mergeDeep({}, this.fetchOptions);
+ return Utils.sendRequest(Utils.mergeDeep({}, this), options).catch(error => {
+ // Add HTTP status code to the error object if it exists
+ if (error.status) {
+ return Promise.reject({
+ ...error,
+ http_code: error.status, // Adding the HTTP status code explicitly
+ http_message: error.statusText || 'An error occurred'
+ });
+ }
+ return Promise.reject(error); // Fallback for other errors
+ });
+ }
+}
diff --git a/src/core/modules/result.js b/src/core/modules/result.js
index b0d2053a..024e04d5 100755
--- a/src/core/modules/result.js
+++ b/src/core/modules/result.js
@@ -1,4 +1,4 @@
-import * as Utils from '../lib/utils'
+import * as Utils from '../lib/utils';
/**
* @class Result
@@ -18,20 +18,19 @@ import * as Utils from '../lib/utils'
* // error function
* })
* @returns {Result}
- * @instance
+ * @instance
*/
export default class Result {
- constructor(object){
- if(object) {
- this.object = function() {
- return object;
- }
- }
- return this;
+ constructor (object) {
+ if (object) {
+ this.object = function () {
+ return object;
+ };
}
+ return this;
+ }
-
- /**
+ /**
* @method toJSON
* @memberOf Result
* @description Converts `Result` to plain javascript object.
@@ -48,13 +47,13 @@ export default class Result {
* // error function
* })
* @returns {object}
- * @instance
+ * @instance
*/
- toJSON() {
- return (this.object()) ? Utils.mergeDeep(JSON.parse(JSON.stringify({})), this.object()) : null;
- }
+ toJSON () {
+ return (this.object()) ? Utils.mergeDeep(JSON.parse(JSON.stringify({})), this.object()) : null;
+ }
- /**
+ /**
* @method get
* @memberOf Result
* @description Retrieve details of a field based on the UID provided
@@ -72,20 +71,19 @@ export default class Result {
* // error function
* })
* @returns {promise}
- * @instance
+ * @instance
*/
- get(key){
- if(this.object() && key) {
- let fields = key.split('.');
- let value = fields.reduce(function(prev, field) {
- return prev[field];
- }, this.object());
- return value;
- }
- return ;
+ get (key) {
+ if (this.object() && key) {
+ const fields = key.split('.');
+ const value = fields.reduce(function (prev, field) {
+ return prev[field];
+ }, this.object());
+ return value;
}
+ }
- /**
+ /**
* @method getDownloadUrl
* @memberOf Result
* @description Retrieves the download URL based on the disposition value.
@@ -97,13 +95,13 @@ export default class Result {
* // error function
* })
* @returns {Object}
- * @instance
+ * @instance
*/
- getDownloadUrl(disposition) {
- if (this.object()) {
- let url = (this.object().url) ? this.object().url : null,
- _disposition = (disposition && typeof disposition === 'string') ? disposition: 'attachment';
- return (url) ? url + '?disposition=' + _disposition : null;
- }
- }
-}
\ No newline at end of file
+ getDownloadUrl (disposition) {
+ if (this.object()) {
+ const url = (this.object().url) ? this.object().url : null;
+ const _disposition = (disposition && typeof disposition === 'string') ? disposition : 'attachment';
+ return (url) ? url + '?disposition=' + _disposition : null;
+ }
+ }
+}
diff --git a/src/core/modules/taxonomy.js b/src/core/modules/taxonomy.js
index 9519e86f..7f1a1f6b 100644
--- a/src/core/modules/taxonomy.js
+++ b/src/core/modules/taxonomy.js
@@ -1,25 +1,25 @@
-import Query from "./query";
+import Query from './query';
// Overrideing compare function to include level
const _extend = {
- compare: function(type) {
- return function(key, value, levels) {
- if (key && value && typeof key === 'string' && typeof value !== 'undefined') {
- this._query['query'][key] = this._query['query']['file_size'] || {};
- this._query['query'][key][type] = value;
- if (levels && typeof levels === "number") {
- this._query['query'][key]['levels'] = levels
- }
- return this;
- } else {
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Kindly provide valid parameters.");
+ compare: function (type) {
+ return function (key, value, levels) {
+ if (key && value && typeof key === 'string' && typeof value !== 'undefined') {
+ this._query.query[key] = this._query.query.file_size || {};
+ this._query.query[key][type] = value;
+ if (levels && typeof levels === 'number') {
+ this._query.query[key].levels = levels;
}
+ return this;
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'Kindly provide valid parameters.');
+ }
};
}
-}
+};
export default class Taxonomy extends Query {
- constructor() {
+ constructor () {
super();
/**
* @method above
@@ -39,7 +39,7 @@ export default class Taxonomy extends Query {
* @returns {Query}
* @instance
*/
- this.above = _extend.compare('$above')
+ this.above = _extend.compare('$above');
/**
* @method equalAndAbove
@@ -59,8 +59,8 @@ export default class Taxonomy extends Query {
* @returns {Query}
* @instance
*/
- this.equalAndAbove = _extend.compare('$eq_above')
-
+ this.equalAndAbove = _extend.compare('$eq_above');
+
/**
* @method below
* @memberOf Query
@@ -79,8 +79,8 @@ export default class Taxonomy extends Query {
* @returns {Query}
* @instance
*/
- this.below = _extend.compare('$below')
-
+ this.below = _extend.compare('$below');
+
/**
* @method equalAndBelow
* @memberOf Query
@@ -99,6 +99,6 @@ export default class Taxonomy extends Query {
* @returns {Query}
* @instance
*/
- this.equalAndBelow = _extend.compare('$eq_below')
+ this.equalAndBelow = _extend.compare('$eq_below');
}
-}
\ No newline at end of file
+}
diff --git a/src/core/stack.js b/src/core/stack.js
index b9206fd3..dea47b8e 100755
--- a/src/core/stack.js
+++ b/src/core/stack.js
@@ -6,11 +6,11 @@ import Query from './modules/query';
import Taxonomy from './modules/taxonomy';
import Request from './lib/request';
import CacheProvider from './cache-provider/index';
-let errorRetry = [408, 429]
+const errorRetry = [408, 429];
/**
- * @class
- Stack
+ * @class
+ Stack
* @description Initialize an instance of ‘Stack’
* @param param - Stack configuration.
* @param param.api_key - Stack API Key.
@@ -29,7 +29,7 @@ let errorRetry = [408, 429]
* @param param.fetchOptions.retryDelayOptions.base - The base number of milliseconds to use in the exponential backoff for operation retries.
* @param param.fetchOptions.retryDelayOptions.customBackoff - A custom function that accepts a retry count and error and returns the amount of time to delay in milliseconds.
* @param param.fetchOptions.logHandler - A function for logging of requests, responses and errors
- *
+ *
* @example
* var Stack = Contentstack.Stack({
* 'api_key':'api_key',
@@ -37,154 +37,149 @@ let errorRetry = [408, 429]
* 'environment':'environment_name',
* 'region': 'us',
* 'fetchOptions': {
- *
+ *
* }
* });
- *
+ *
* @returns {Stack}
* @instance
*/
export default class Stack {
- constructor(...stack_arguments) {
- this.fetchOptions = {
- retryLimit: 5,
- retryCondition: (error) => {
- if (errorRetry.includes(error.status)) {
- return true;
- }
- return false
- },
- debug: false,
- logHandler: (level, data) => {
- if (level === 'error' && data) {
- console.error(`[error] ${data}`)
- return
- } else if (level === 'warning' && data) {
- console.warn(`[warning] ${data}`)
- return
- } else if (level === 'info' && data) {
- console.info(`[info] ${data}`)
- return
- }
- }
- };
- this.config = JSON.parse(JSON.stringify(config));
- this.plugins = []
-
- if (stack_arguments[0].live_preview && stack_arguments[0].live_preview.enable === true && stack_arguments[0].live_preview.management_token !== null) {
- if (stack_arguments[0].live_preview.management_token) {
- this.config.live_preview.host = 'api.contentstack.io';
- }
+ constructor (...stack_arguments) {
+ this.fetchOptions = {
+ retryLimit: 5,
+ retryCondition: (error) => {
+ if (errorRetry.includes(error.status)) {
+ return true;
}
-
- if(stack_arguments[0].region && stack_arguments[0].region !== undefined && stack_arguments[0].region !== "us") {
- this.config['host'] = stack_arguments[0].region+"-"+"cdn.contentstack.com";
- if (stack_arguments[0].live_preview && stack_arguments[0].live_preview.enable === true) {
- if (stack_arguments[0].live_preview.management_token) {
- this.config["live_preview"]["host"] = stack_arguments[0].region + "-" + "api.contentstack.com";
- } else {
- this.config["live_preview"]["host"] = stack_arguments[0].region + "-" + "rest-preview.contentstack.com";
- }
- }
- }
-
- if (stack_arguments[0].fetchOptions && stack_arguments[0].fetchOptions !== undefined) {
- this.fetchOptions = Utils.mergeDeep(this.fetchOptions, stack_arguments[0].fetchOptions);
+ return false;
+ },
+ debug: false,
+ logHandler: (level, data) => {
+ if (level === 'error' && data) {
+ console.error(`[error] ${data}`);
+ } else if (level === 'warning' && data) {
+ console.warn(`[warning] ${data}`);
+ } else if (level === 'info' && data) {
+ console.info(`[info] ${data}`);
}
+ }
+ };
+ this.config = JSON.parse(JSON.stringify(config));
+ this.plugins = [];
+
+ if (stack_arguments[0].live_preview && stack_arguments[0].live_preview.enable === true && stack_arguments[0].live_preview.management_token !== null) {
+ if (stack_arguments[0].live_preview.management_token) {
+ this.config.live_preview.host = 'api.contentstack.io';
+ }
+ }
- if (stack_arguments[0].plugins && stack_arguments[0].plugins !== undefined) {
-
- stack_arguments[0].plugins.forEach(pluginObj => {
- this.plugins.push(pluginObj)
- });
+ if (stack_arguments[0].region && stack_arguments[0].region !== undefined && stack_arguments[0].region !== 'us') {
+ this.config.host = stack_arguments[0].region + '-' + 'cdn.contentstack.com';
+ if (stack_arguments[0].live_preview && stack_arguments[0].live_preview.enable === true) {
+ if (stack_arguments[0].live_preview.management_token) {
+ this.config.live_preview.host = stack_arguments[0].region + '-' + 'api.contentstack.com';
+ } else {
+ this.config.live_preview.host = stack_arguments[0].region + '-' + 'rest-preview.contentstack.com';
}
-
- this.cachePolicy = CacheProvider.policies.IGNORE_CACHE;
- this.provider = CacheProvider.providers('localstorage');
-
- switch (stack_arguments.length) {
- case 1:
- if (typeof stack_arguments[0] === "object" && typeof stack_arguments[0].api_key === "string" && typeof stack_arguments[0].delivery_token === "string" && typeof stack_arguments[0].environment === "string") {
- this.headers = {
- api_key: stack_arguments[0].api_key,
- access_token: stack_arguments[0].delivery_token
- };
- if (typeof stack_arguments[0].live_preview == "object") {
- this.live_preview = Utils.mergeDeep(this.config.live_preview , stack_arguments[0].live_preview)
- this.setLivePreviewTimelinePreviewForClient()
- }
- if (typeof stack_arguments[0].branch === "string" && stack_arguments[0].branch !== undefined) {
- this.headers.branch = stack_arguments[0].branch
- }
- if (typeof stack_arguments[0].early_access == "object" && Array.isArray(stack_arguments[0].early_access) && stack_arguments[0].early_access.length > 0) {
- this.headers['x-header-ea'] = stack_arguments[0].early_access.join(',')
- }
- this.environment = stack_arguments[0].environment;
- return this;
- } else {
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Kindly provide valid object parameters. The specified API Key, Delivery Token, or Environment Name is invalid.");
- }
- case 3:
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('warning', "WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!");
- if (typeof stack_arguments[0] === "string" && typeof stack_arguments[1] === "string" && typeof stack_arguments[2] === "string") {
- this.headers = {
- api_key: stack_arguments[0],
- access_token: stack_arguments[1]
- };
- this.environment = stack_arguments[2];
- return this;
- } else {
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Kindly provide valid string parameters.");
- }
- case 4:
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('warning', "WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!");
- if (typeof stack_arguments[0] === "string" && typeof stack_arguments[1] === "string" && typeof stack_arguments[2] === "string") {
- this.headers = {
- api_key: stack_arguments[0],
- access_token: stack_arguments[1]
- };
- this.environment = stack_arguments[2];
- } else {
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Kindly provide valid string parameters.");
- }
- if (stack_arguments[3]) {
- if(typeof stack_arguments[3] === "string" && stack_arguments[3] !== undefined && stack_arguments[3] !== "us") {
- this.config['host'] = stack_arguments[3]+"-"+"cdn.contentstack.com";
- } else if (typeof stack_arguments[3] === 'object') {
- this.fetchOptions = Utils.mergeDeep(this.fetchOptions, stack_arguments[3]);
- }
- }
- return this;
- case 5:
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('warning', "WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!");
- if (typeof stack_arguments[0] === "string" && typeof stack_arguments[1] === "string" && typeof stack_arguments[2] === "string") {
- this.headers = {
- api_key: stack_arguments[0],
- access_token: stack_arguments[1]
- };
- this.environment = stack_arguments[2];
- } else {
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Kindly provide valid string parameters.");
- }
-
- if (stack_arguments[3]) {
- if(typeof stack_arguments[3] === "string" && stack_arguments[3] !== undefined && stack_arguments[3] !== "us") {
- this.config['host'] = stack_arguments[3]+"-"+"cdn.contentstack.com";
- } else if (typeof stack_arguments[3] === 'object') {
- this.fetchOptions = Utils.mergeDeep(this.fetchOptions, stack_arguments[3]);
- }
- }
- if (stack_arguments[4] && typeof stack_arguments[4] === 'object') {
- this.fetchOptions = Utils.mergeDeep(this.fetchOptions, stack_arguments[4]);
- }
- return this;
- default:
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Kindly provide valid parameters to initialize the Contentstack javascript-SDK Stack.");
+ }
+ }
+
+ if (stack_arguments[0].fetchOptions && stack_arguments[0].fetchOptions !== undefined) {
+ this.fetchOptions = Utils.mergeDeep(this.fetchOptions, stack_arguments[0].fetchOptions);
+ }
+
+ if (stack_arguments[0].plugins && stack_arguments[0].plugins !== undefined) {
+ stack_arguments[0].plugins.forEach(pluginObj => {
+ this.plugins.push(pluginObj);
+ });
+ }
+
+ this.cachePolicy = CacheProvider.policies.IGNORE_CACHE;
+ this.provider = CacheProvider.providers('localstorage');
+
+ switch (stack_arguments.length) {
+ case 1:
+ if (typeof stack_arguments[0] === 'object' && typeof stack_arguments[0].api_key === 'string' && typeof stack_arguments[0].delivery_token === 'string' && typeof stack_arguments[0].environment === 'string') {
+ this.headers = {
+ api_key: stack_arguments[0].api_key,
+ access_token: stack_arguments[0].delivery_token
+ };
+ if (typeof stack_arguments[0].live_preview === 'object') {
+ this.live_preview = Utils.mergeDeep(this.config.live_preview, stack_arguments[0].live_preview);
+ this.setLivePreviewTimelinePreviewForClient();
+ }
+ if (typeof stack_arguments[0].branch === 'string' && stack_arguments[0].branch !== undefined) {
+ this.headers.branch = stack_arguments[0].branch;
+ }
+ if (typeof stack_arguments[0].early_access === 'object' && Array.isArray(stack_arguments[0].early_access) && stack_arguments[0].early_access.length > 0) {
+ this.headers['x-header-ea'] = stack_arguments[0].early_access.join(',');
+ }
+ this.environment = stack_arguments[0].environment;
+ return this;
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'Kindly provide valid object parameters. The specified API Key, Delivery Token, or Environment Name is invalid.');
+ }
+ case 3:
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('warning', "WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!");
+ if (typeof stack_arguments[0] === 'string' && typeof stack_arguments[1] === 'string' && typeof stack_arguments[2] === 'string') {
+ this.headers = {
+ api_key: stack_arguments[0],
+ access_token: stack_arguments[1]
+ };
+ this.environment = stack_arguments[2];
+ return this;
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'Kindly provide valid string parameters.');
+ }
+ case 4:
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('warning', "WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!");
+ if (typeof stack_arguments[0] === 'string' && typeof stack_arguments[1] === 'string' && typeof stack_arguments[2] === 'string') {
+ this.headers = {
+ api_key: stack_arguments[0],
+ access_token: stack_arguments[1]
+ };
+ this.environment = stack_arguments[2];
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'Kindly provide valid string parameters.');
+ }
+ if (stack_arguments[3]) {
+ if (typeof stack_arguments[3] === 'string' && stack_arguments[3] !== undefined && stack_arguments[3] !== 'us') {
+ this.config.host = stack_arguments[3] + '-' + 'cdn.contentstack.com';
+ } else if (typeof stack_arguments[3] === 'object') {
+ this.fetchOptions = Utils.mergeDeep(this.fetchOptions, stack_arguments[3]);
+ }
+ }
+ return this;
+ case 5:
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('warning', "WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!");
+ if (typeof stack_arguments[0] === 'string' && typeof stack_arguments[1] === 'string' && typeof stack_arguments[2] === 'string') {
+ this.headers = {
+ api_key: stack_arguments[0],
+ access_token: stack_arguments[1]
+ };
+ this.environment = stack_arguments[2];
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'Kindly provide valid string parameters.');
}
+ if (stack_arguments[3]) {
+ if (typeof stack_arguments[3] === 'string' && stack_arguments[3] !== undefined && stack_arguments[3] !== 'us') {
+ this.config.host = stack_arguments[3] + '-' + 'cdn.contentstack.com';
+ } else if (typeof stack_arguments[3] === 'object') {
+ this.fetchOptions = Utils.mergeDeep(this.fetchOptions, stack_arguments[3]);
+ }
+ }
+ if (stack_arguments[4] && typeof stack_arguments[4] === 'object') {
+ this.fetchOptions = Utils.mergeDeep(this.fetchOptions, stack_arguments[4]);
+ }
+ return this;
+ default:
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'Kindly provide valid parameters to initialize the Contentstack javascript-SDK Stack.');
}
+ }
- /**
+ /**
* @method setPort
* @memberOf Stack
* @description Sets the port of the host
@@ -192,12 +187,12 @@ export default class Stack {
* @return {Stack}
* @instance
* */
- setPort(port) {
- if (typeof port === "number") this.config.port = port;
- return this;
- }
+ setPort (port) {
+ if (typeof port === 'number') this.config.port = port;
+ return this;
+ }
- /**
+ /**
* @method setProtocol
* @memberOf Stack
* @description Sets the protocol for the host
@@ -205,12 +200,12 @@ export default class Stack {
* @return {Stack}
* @instance
* */
- setProtocol(protocol) {
- if (typeof protocol === "string" && ~["https", "http"].indexOf(protocol)) this.config.protocol = protocol;
- return this;
- }
+ setProtocol (protocol) {
+ if (typeof protocol === 'string' && ~['https', 'http'].indexOf(protocol)) this.config.protocol = protocol;
+ return this;
+ }
- /**
+ /**
* @method setHost
* @memberOf Stack
* @description Sets the host of the API server
@@ -218,12 +213,12 @@ export default class Stack {
* @return {Stack}
* @instance
* */
- setHost(host) {
- if (typeof host === "string" && host) this.config.host = host;
- return this;
- }
+ setHost (host) {
+ if (typeof host === 'string' && host) this.config.host = host;
+ return this;
+ }
- /**
+ /**
* @method setCachePolicy
* @memberOf Stack
* @description Allows you to set cache policies
@@ -237,58 +232,58 @@ export default class Stack {
* @returns {Stack}
* @instance
*/
- setCachePolicy(policy) {
- if (typeof policy === 'number' && policy >= -1 && policy < 4) {
- if (!this._query) {
- this.cachePolicy = policy;
- } else {
- this.queryCachePolicy = policy;
- }
- } else {
- if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', "Kindly provide the valid policy");
- }
- return this;
+ setCachePolicy (policy) {
+ if (typeof policy === 'number' && policy >= -1 && policy < 4) {
+ if (!this._query) {
+ this.cachePolicy = policy;
+ } else {
+ this.queryCachePolicy = policy;
+ }
+ } else {
+ if (this.fetchOptions.debug) this.fetchOptions.logHandler('error', 'Kindly provide the valid policy');
}
-
- setLivePreviewTimelinePreviewForClient() {
- if (Utils.isBrowser()){
- const params = new URL(document.location.toString()).searchParams;
- if (params.has('live_preview')) {
- this.live_preview.live_preview = params.get('live_preview');
- }
- if (params.has('release_id')) {
- this.headers['release_id'] = params.get('release_id');
- } else {
- delete this.headers['release_id'];
- }
- if (params.has('preview_timestamp')) {
- this.headers['preview_timestamp'] = params.get('preview_timestamp');
- } else {
- delete this.headers['preview_timestamp'];
- }
- }
+ return this;
+ }
+
+ setLivePreviewTimelinePreviewForClient () {
+ if (Utils.isBrowser()) {
+ const params = new URL(document.location.toString()).searchParams;
+ if (params.has('live_preview')) {
+ this.live_preview.live_preview = params.get('live_preview');
+ }
+ if (params.has('release_id')) {
+ this.headers.release_id = params.get('release_id');
+ } else {
+ delete this.headers.release_id;
+ }
+ if (params.has('preview_timestamp')) {
+ this.headers.preview_timestamp = params.get('preview_timestamp');
+ } else {
+ delete this.headers.preview_timestamp;
+ }
}
+ }
- livePreviewQuery(query) {
- if (this.live_preview) {
- this.live_preview.live_preview = query.live_preview || 'init';
- this.live_preview.content_type_uid = query.content_type_uid;
- this.live_preview.entry_uid = query.entry_uid
- }
+ livePreviewQuery (query) {
+ if (this.live_preview) {
+ this.live_preview.live_preview = query.live_preview || 'init';
+ this.live_preview.content_type_uid = query.content_type_uid;
+ this.live_preview.entry_uid = query.entry_uid;
+ }
- if (query.hasOwnProperty('release_id')) {
- this.headers['release_id'] = query.release_id;
- } else {
- delete this.headers['release_id'];
- }
- if (query.hasOwnProperty('preview_timestamp')) {
- this.headers['preview_timestamp'] = query.preview_timestamp;
- } else {
- delete this.headers['preview_timestamp'];
- }
+ if (query.hasOwnProperty('release_id')) {
+ this.headers.release_id = query.release_id;
+ } else {
+ delete this.headers.release_id;
+ }
+ if (query.hasOwnProperty('preview_timestamp')) {
+ this.headers.preview_timestamp = query.preview_timestamp;
+ } else {
+ delete this.headers.preview_timestamp;
}
+ }
- /**
+ /**
* @method setCacheProvider
* @memberOf Stack
* @description Allows you to set an object of the cache provider
@@ -305,15 +300,14 @@ export default class Stack {
* @returns {Stack}
* @instance
*/
- setCacheProvider(provider) {
- if (provider && typeof provider === 'object') {
- this.provider = provider;
-
- }
- return this;
+ setCacheProvider (provider) {
+ if (provider && typeof provider === 'object') {
+ this.provider = provider;
}
+ return this;
+ }
- /**
+ /**
* @method clearByQuery
* @memberOf Stack
* @description 'clearByQuery' function to clear the query from the cache.
@@ -322,13 +316,13 @@ export default class Stack {
* @returns {Stack}
* @instance
*/
- clearByQuery() {
- if (this.provider && typeof this.provider.clearByQuery === 'function') {
- return this.provider.clearByQuery.apply(this.provider, arguments);
- }
+ clearByQuery () {
+ if (this.provider && typeof this.provider.clearByQuery === 'function') {
+ return this.provider.clearByQuery.apply(this.provider, arguments);
}
+ }
- /**
+ /**
* @method clearByContentType
* @memberOf Stack
* @description 'clearByContentType' function to clear the query from the cache by specified content type.
@@ -338,28 +332,28 @@ export default class Stack {
* @returns {Stack}
* @instance
*/
- clearByContentType() {
- if (this.provider && typeof this.provider.clearByContentType === 'function') {
- return this.provider.clearByContentType.apply(this.provider, arguments);
- }
+ clearByContentType () {
+ if (this.provider && typeof this.provider.clearByContentType === 'function') {
+ return this.provider.clearByContentType.apply(this.provider, arguments);
}
+ }
- /**
+ /**
* @method clearAll
* @memberOf Stack
* @description 'clearAll' function to clear all the queries from cache.
* @example
* Stack.clearAll(callback);
* @returns {Stack}
- * @instance
+ * @instance
*/
- clearAll() {
- if (this.provider && typeof this.provider.clearAll === 'function') {
- return this.provider.clearAll.apply(this.provider, arguments);
- }
+ clearAll () {
+ if (this.provider && typeof this.provider.clearAll === 'function') {
+ return this.provider.clearAll.apply(this.provider, arguments);
}
+ }
- /**
+ /**
* @method getCacheProvider
* @memberOf Stack
* @description Returns the currently set object of 'CacheProvider'
@@ -367,62 +361,62 @@ export default class Stack {
* @returns {object}
* @instance
*/
- getCacheProvider() {
- return this.provider;
- }
+ getCacheProvider () {
+ return this.provider;
+ }
- /**
+ /**
* @method ContentType
* @memberOf Stack
* @description Set the content type of which you want to retrieve the entries
* @param {String} [content_type_uid] - uid of the existing content type
- * @example
+ * @example
* let data = Stack.ContentType('blog').Query().toJSON().find()
* data
* .then(function(result) {
- * // 'result' content the list of entries of particular content type blog.
+ * // 'result' content the list of entries of particular content type blog.
* }, function(error) {
* // error function
* })
* @returns {Stack}
* @instance
*/
- ContentType(uid) {
- if (uid && typeof uid === 'string') {
- this.content_type_uid = uid;
- this.type = "contentType";
- }
- return this;
+ ContentType (uid) {
+ if (uid && typeof uid === 'string') {
+ this.content_type_uid = uid;
+ this.type = 'contentType';
}
+ return this;
+ }
- /**
+ /**
* @method Taxonomies
* @memberof Stack
* @description A method to set base url to taxonomies endpoint
* @returns {Stack}
*/
- Taxonomies() {
- this.type = "taxonomy"
- return Utils.merge(new Taxonomy(), this);
- }
+ Taxonomies () {
+ this.type = 'taxonomy';
+ return Utils.merge(new Taxonomy(), this);
+ }
- /**
+ /**
* @method Entry
* @memberOf ContentType
- * @param {String} uid - uid of the entry
+ * @param {String} uid - uid of the entry
* @description An initializer is responsible for creating Entry object
* @returns {Entry}
- * @instance
+ * @instance
*/
- Entry(uid) {
- let entry = new Entry();
- if (uid && typeof uid === "string") {
- entry.entry_uid = uid;
- }
- return Utils.merge(entry, this);
+ Entry (uid) {
+ const entry = new Entry();
+ if (uid && typeof uid === 'string') {
+ entry.entry_uid = uid;
}
+ return Utils.merge(entry, this);
+ }
- /**
+ /**
* @method fetch
* @memberOf ContentType
* @description This method returns the complete information of a specific content type.
@@ -430,211 +424,211 @@ export default class Stack {
* let single_contenttype = Stack.ContentType(content_type_uid).fetch()
* single_contenttype
* .then(function(result) {
- * // 'result' is a single contentType information.
+ * // 'result' is a single contentType information.
* }).catch((error) => {
* console.log(error)
* });
* @returns {promise}
- * @instance
+ * @instance
*/
- fetch(fetchOptions) {
- this.requestParams = {
- method: 'POST',
- headers: Utils.mergeDeep({}, this.headers),
- plugins: this.plugins,
- url: this.config.protocol + "://" + this.config.host + ':' + this.config.port + '/' + this.config.version + this.config.urls.content_types + this.content_type_uid,
- body: {
- _method: 'GET',
- environment: this.environment
- }
- };
- var options = Utils.mergeDeep(this.fetchOptions, fetchOptions);
- return Request(this, options);
- }
-
- /**
+ fetch (fetchOptions) {
+ this.requestParams = {
+ method: 'POST',
+ headers: Utils.mergeDeep({}, this.headers),
+ plugins: this.plugins,
+ url: this.config.protocol + '://' + this.config.host + ':' + this.config.port + '/' + this.config.version + this.config.urls.content_types + this.content_type_uid,
+ body: {
+ _method: 'GET',
+ environment: this.environment
+ }
+ };
+ const options = Utils.mergeDeep(this.fetchOptions, fetchOptions);
+ return Request(this, options);
+ }
+
+ /**
* @method Assets
* @memberOf Stack
- * @param {String} uid - uid of the asset
+ * @param {String} uid - uid of the asset
* @description Retrieves all assets of a stack by default. To retrieve a single asset, specify its UID.
- * @example
+ * @example
* // Retrieves all assets
* let data = Stack.Assets().Query().toJSON().find()
* data
* .then(function(result) {
* // All the asset with limit of 100
* // Use skip and limit functions to paginate
- * // ‘result’ will display all assets present in stack
+ * // ‘result’ will display all assets present in stack
* }, function(error) {
* // error function
* })
- *
- * @example
+ *
+ * @example
* let data = Stack.Assets('asset_uid').toJSON().fetch()
* data
* .then(function(result) {
- * // ‘result’ is a single asset object of specified uid
+ * // ‘result’ is a single asset object of specified uid
* }, function(error) {
* // error function
* })
- *
+ *
* @returns {Assets}
- * @instance
+ * @instance
*/
- Assets(uid) {
- this.type = 'asset';
- if (uid && typeof uid === "string") {
- let asset = new Assets();
- asset.asset_uid = uid;
- return Utils.merge(asset, this);
- }
- return this;
+ Assets (uid) {
+ this.type = 'asset';
+ if (uid && typeof uid === 'string') {
+ const asset = new Assets();
+ asset.asset_uid = uid;
+ return Utils.merge(asset, this);
}
+ return this;
+ }
- /**
+ /**
* @method Query
* @memberOf Stack
* @description An initializer is responsible for creating Query object.Provides support for all search queries
* @returns {Query}
- * @instance
+ * @instance
*/
- Query() {
- // Taxonomy is a class that extends Query class and adds 4 more helper methods that use levels.
- // These 4 methods also work on contentType base url, hence Taxonomy instance is returned
- // Taxonomy instance is Regular Query instance + 4 additional methods (below, eq_below, above, eq_above)
- let query = (this.type === "contentType") ?
- new Taxonomy() :
- new Query();
- return Utils.merge(query, this);
- }
-
- /**
+ Query () {
+ // Taxonomy is a class that extends Query class and adds 4 more helper methods that use levels.
+ // These 4 methods also work on contentType base url, hence Taxonomy instance is returned
+ // Taxonomy instance is Regular Query instance + 4 additional methods (below, eq_below, above, eq_above)
+ const query = (this.type === 'contentType')
+ ? new Taxonomy()
+ : new Query();
+ return Utils.merge(query, this);
+ }
+
+ /**
* @method getLastActivities
* @memberOf Stack
* @description getLastActivities get all the ContentTypes whose last activity updated.
* @example Stack.getLastActivities()
- * @example
+ * @example
* let data = Stack.getLastActivities().toJSON().fetch()
* data
* .then(function(result) {
- * // 'result' is list of contentTypes whose last activity updated.
+ * // 'result' is list of contentTypes whose last activity updated.
* }, function(error) {
* // error function
* })
* @returns {promise}
* @instance
*/
- getLastActivities() {
- this.requestParams = {
- method: 'POST',
- headers: Utils.mergeDeep({}, this.headers),
- url: this.config.protocol + "://" + this.config.host + ':' + this.config.port + '/' + this.config.version + this.config.urls.content_types,
- body: {
- _method: 'GET',
- only_last_activity: true,
- environment: this.environment
- }
- };
- return Request(this, this.fetchOptions);
- }
-
- /**
+ getLastActivities () {
+ this.requestParams = {
+ method: 'POST',
+ headers: Utils.mergeDeep({}, this.headers),
+ url: this.config.protocol + '://' + this.config.host + ':' + this.config.port + '/' + this.config.version + this.config.urls.content_types,
+ body: {
+ _method: 'GET',
+ only_last_activity: true,
+ environment: this.environment
+ }
+ };
+ return Request(this, this.fetchOptions);
+ }
+
+ /**
* @method getContentTypes
* @memberOf Stack
* @param {String} param - Query on contentTypes
* @description This method returns comprehensive information of all the content types of a particular stack in your account.
- * @example
+ * @example
* let data = Stack.getContentTypes({"include_global_field_schema": true})
* data
* .then(function(result) {
- * // 'result' is list of contentTypes.
+ * // 'result' is list of contentTypes.
* }, function(error) {
* // error function
* })
* @returns {promise}
* @instance
*/
- getContentTypes(param = {}) {
- this.requestParams = {
- method: 'POST',
- headers: Utils.mergeDeep({}, this.headers),
- url: this.config.protocol + "://" + this.config.host + ':' + this.config.port + '/' + this.config.version + this.config.urls.content_types,
- body: {
- _method: 'GET',
- environment: this.environment
- }
- };
- if(param) {
- for( var key in param) {
- this.requestParams.body[key] = param[key]
- }
- }
- return Request(this, this.fetchOptions);
+ getContentTypes (param = {}) {
+ this.requestParams = {
+ method: 'POST',
+ headers: Utils.mergeDeep({}, this.headers),
+ url: this.config.protocol + '://' + this.config.host + ':' + this.config.port + '/' + this.config.version + this.config.urls.content_types,
+ body: {
+ _method: 'GET',
+ environment: this.environment
+ }
+ };
+ if (param) {
+ for (const key in param) {
+ this.requestParams.body[key] = param[key];
+ }
}
+ return Request(this, this.fetchOptions);
+ }
- /**
+ /**
* @method sync
* @memberOf Stack
* @description Syncs your Contentstack data with your app and ensures that the data is always up-to-date by providing delta updates
* @param {object} params - params is an object that supports ‘locale’, ‘start_date’, ‘content_type_uid’, and ‘type’ queries.
- * @example
+ * @example
* Stack.sync({'init': true}) // For initializing sync
- * @example
+ * @example
* Stack.sync({'init': true, 'locale': 'en-us'}) //For initializing sync with entries of a specific locale
- * @example
+ * @example
* Stack.sync({'init': true, 'start_date': '2018-10-22'}) //For initializing sync with entries published after a specific date
- * @example
+ * @example
* Stack.sync({'init': true, 'content_type_uid': 'session'}) //For initializing sync with entries of a specific content type
- * @example
+ * @example
* Stack.sync({'init': true, 'type': 'entry_published'}) //Use the type parameter to get a specific type of content.Supports 'asset_published', 'entry_published', 'asset_unpublished', 'entry_unpublished', 'asset_deleted', 'entry_deleted', 'content_type_deleted'.
- * @example
+ * @example
* Stack.sync({'pagination_token': ''}) // For fetching the next batch of entries using pagination token
- * @example
+ * @example
* Stack.sync({'sync_token': ''}) // For performing subsequent sync after initial sync
* @returns {promise}
* @instance
*/
- sync(params, fetchOptions) {
- if (params && typeof params !== "object") {
- throw new Error("Invalid parameters: params must be an object.");
- }
- this._query = {};
-
- if (params) {
- for (const key in params) {
- const value = params[key];
- if (params.hasOwnProperty(key)) {
- if (
- typeof value !== "string" &&
- typeof value !== "number" &&
- typeof value !== "boolean" &&
+ sync (params, fetchOptions) {
+ if (params && typeof params !== 'object') {
+ throw new Error('Invalid parameters: params must be an object.');
+ }
+ this._query = {};
+
+ if (params) {
+ for (const key in params) {
+ const value = params[key];
+ if (params.hasOwnProperty(key)) {
+ if (
+ typeof value !== 'string' &&
+ typeof value !== 'number' &&
+ typeof value !== 'boolean' &&
!(value instanceof RegExp) &&
- (typeof value !== "object" || value === null)
- ) {
- throw new Error(`Invalid parameter value for key "${key}": must be a string, number, object, boolean, or RegExp.`);
- }
- this._query[key] = params[key];
- }
- }
+ (typeof value !== 'object' || value === null)
+ ) {
+ throw new Error(`Invalid parameter value for key "${key}": must be a string, number, object, boolean, or RegExp.`);
+ }
+ this._query[key] = params[key];
}
- this.requestParams = {
- method: 'POST',
- headers: Utils.mergeDeep({}, this.headers),
- url: this.config.protocol + "://" + this.config.host + ':' + this.config.port + '/' + this.config.version + this.config.urls.sync,
- body: {
- _method: 'GET',
- query: this._query
- }
- }
- var options = Utils.mergeDeep(this.fetchOptions, fetchOptions);
- return Utils.sendRequest(Utils.mergeDeep({}, this), options);
+ }
}
-
- /**
+ this.requestParams = {
+ method: 'POST',
+ headers: Utils.mergeDeep({}, this.headers),
+ url: this.config.protocol + '://' + this.config.host + ':' + this.config.port + '/' + this.config.version + this.config.urls.sync,
+ body: {
+ _method: 'GET',
+ query: this._query
+ }
+ };
+ const options = Utils.mergeDeep(this.fetchOptions, fetchOptions);
+ return Utils.sendRequest(Utils.mergeDeep({}, this), options);
+ }
+
+ /**
* @method imageTransform
* @memberOf Stack
- * @description Performs transformations on images of mentioned url based on transformation parameters
+ * @description Performs transformations on images of mentioned url based on transformation parameters
* @param {String} url - Image url on which transformations need to be applied.
* @param {String} params - Object with transformation parameters
* @example
@@ -646,17 +640,17 @@ export default class Stack {
* @returns {string} [Image url with transformation parameters.]
* @instance
*/
- imageTransform(url, params) {
- if (url && typeof url === "string" && typeof params === "object" && params.length === undefined) {
- let queryParams = [];
- for (const operation in params) {
- const encodedKey = encodeURIComponent(operation);
- const encodedValue = encodeURIComponent(params[operation]);
- queryParams.push(encodedKey + '=' + encodedValue);
- }
- url += (url.indexOf("?") <= -1) ? "?" + queryParams.join('&') : "&" + queryParams.join('&');
- }
-
- return url;
+ imageTransform (url, params) {
+ if (url && typeof url === 'string' && typeof params === 'object' && params.length === undefined) {
+ const queryParams = [];
+ for (const operation in params) {
+ const encodedKey = encodeURIComponent(operation);
+ const encodedValue = encodeURIComponent(params[operation]);
+ queryParams.push(encodedKey + '=' + encodedValue);
+ }
+ url += (url.indexOf('?') <= -1) ? '?' + queryParams.join('&') : '&' + queryParams.join('&');
}
-}
\ No newline at end of file
+
+ return url;
+ }
+}
diff --git a/src/runtime/nativescript/http.js b/src/runtime/nativescript/http.js
index 983b2dba..709bc440 100755
--- a/src/runtime/nativescript/http.js
+++ b/src/runtime/nativescript/http.js
@@ -1 +1 @@
-export default fetch;
\ No newline at end of file
+export default fetch;
diff --git a/src/runtime/node/http.js b/src/runtime/node/http.js
index f663174f..7f9bfbc4 100755
--- a/src/runtime/node/http.js
+++ b/src/runtime/node/http.js
@@ -2,4 +2,4 @@ import ES6Promise from 'es6-promise';
ES6Promise.polyfill();
-export default fetch; // fetch API available in Node.js 18 and later
\ No newline at end of file
+export default fetch; // fetch API available in Node.js 18 and later
diff --git a/src/runtime/react-native/http.js b/src/runtime/react-native/http.js
index a0fd601b..709bc440 100755
--- a/src/runtime/react-native/http.js
+++ b/src/runtime/react-native/http.js
@@ -1,2 +1 @@
export default fetch;
-
diff --git a/src/runtime/web/http.js b/src/runtime/web/http.js
index ea9ced65..b021e45b 100755
--- a/src/runtime/web/http.js
+++ b/src/runtime/web/http.js
@@ -1,4 +1,4 @@
import ES6Promise from 'es6-promise';
ES6Promise.polyfill();
-export default fetch; // fetch API available in Node.js 18 and later
\ No newline at end of file
+export default fetch; // fetch API available in Node.js 18 and later
diff --git a/src/runtime/web/localstorage.js b/src/runtime/web/localstorage.js
index c4791387..ce51d73a 100755
--- a/src/runtime/web/localstorage.js
+++ b/src/runtime/web/localstorage.js
@@ -1,13 +1,12 @@
// export default window.localStorage;
-let webLocalStorage = function (){
- try {
- var storage = window.localStorage
- return storage;
- } catch(e) {
- return null
- }
+const webLocalStorage = function () {
+ try {
+ const storage = window.localStorage;
+ return storage;
+ } catch (e) {
+ return null;
+ }
};
export default webLocalStorage();
-
\ No newline at end of file
diff --git a/test/asset/find-result-wrapper.js b/test/asset/find-result-wrapper.js
index 5c03e016..ff172d1a 100755
--- a/test/asset/find-result-wrapper.js
+++ b/test/asset/find-result-wrapper.js
@@ -1,14 +1,14 @@
-"use strict";
+'use strict';
/*
* Module Dependencies.
*/
-const Contentstack = require("../../dist/node/contentstack.js");
-const init = require("../config.js");
-const Utils = require("../entry/utils.js");
+const Contentstack = require('../../dist/node/contentstack.js');
+const init = require('../config.js');
+const Utils = require('../entry/utils.js');
let Stack;
-describe("Contentstack Asset Tests", () => {
+describe('Contentstack Asset Tests', () => {
// Initialize the Contentstack Stack Instance
beforeAll(() => {
return new Promise((resolve) => {
@@ -18,60 +18,60 @@ describe("Contentstack Asset Tests", () => {
});
});
- describe("default .find() No fallback", () => {
- const _in = ["ja-jp"];
+ describe('default .find() No fallback', () => {
+ const _in = ['ja-jp'];
let assets;
// Setup - run the query once for all tests
beforeAll(async () => {
try {
- assets = await Stack.Assets().Query().language("ja-jp").toJSON().find();
+ assets = await Stack.Assets().Query().language('ja-jp').toJSON().find();
} catch (error) {
- console.error("Error in beforeAll:", error);
+ console.error('Error in beforeAll:', error);
throw error;
}
});
- test("should return a non-empty array of assets", async () => {
+ test('should return a non-empty array of assets', async () => {
expect(assets).toBeDefined();
expect(Array.isArray(assets)).toBe(true);
expect(assets[0]).toBeDefined();
expect(assets[0].length).toBeTruthy();
});
- test("should not include count when not requested", async () => {
+ test('should not include count when not requested', async () => {
expect(assets[1]).toBeFalsy();
});
- test("should return assets only in the requested locale", async () => {
+ test('should return assets only in the requested locale', async () => {
if (assets && assets.length && assets[0].length) {
const allAssetsInRequestedLocale = assets[0].every((asset) => {
- return _in.indexOf(asset["publish_details"]["locale"]) !== -1;
+ return _in.indexOf(asset.publish_details.locale) !== -1;
});
expect(allAssetsInRequestedLocale).toBe(true);
} else {
// Skip this test if no assets are returned
- console.warn("No assets returned to verify locale");
+ console.warn('No assets returned to verify locale');
}
});
- test("should have the correct structure for each asset", async () => {
+ test('should have the correct structure for each asset', async () => {
if (assets && assets.length && assets[0].length) {
const firstAsset = assets[0][0];
- expect(firstAsset).toHaveProperty("uid");
- expect(firstAsset).toHaveProperty("title");
- expect(firstAsset).toHaveProperty("publish_details");
- expect(firstAsset.publish_details).toHaveProperty("locale");
- expect(firstAsset.publish_details.locale).toBe("ja-jp");
+ expect(firstAsset).toHaveProperty('uid');
+ expect(firstAsset).toHaveProperty('title');
+ expect(firstAsset).toHaveProperty('publish_details');
+ expect(firstAsset.publish_details).toHaveProperty('locale');
+ expect(firstAsset.publish_details.locale).toBe('ja-jp');
} else {
// Skip this test if no assets are returned
- console.warn("No assets returned to verify structure");
+ console.warn('No assets returned to verify structure');
}
});
});
- describe("default .find() with fallback", () => {
- const _in = ["ja-jp", "en-us"];
+ describe('default .find() with fallback', () => {
+ const _in = ['ja-jp', 'en-us'];
let assets;
// Setup - run the query once for all tests
@@ -79,69 +79,69 @@ describe("Contentstack Asset Tests", () => {
try {
assets = await Stack.Assets()
.Query()
- .language("ja-jp")
+ .language('ja-jp')
.includeFallback()
.toJSON()
.find();
} catch (error) {
- console.error("Error in beforeAll:", error);
+ console.error('Error in beforeAll:', error);
throw error;
}
});
- test("should return a non-empty array of assets", async () => {
+ test('should return a non-empty array of assets', async () => {
expect(assets).toBeDefined();
expect(Array.isArray(assets)).toBe(true);
expect(assets[0]).toBeDefined();
expect(assets[0].length).toBeTruthy();
});
- test("should not include count when not requested", async () => {
+ test('should not include count when not requested', async () => {
expect(assets[1]).toBeFalsy();
});
- test("should return assets from both primary and fallback locales", async () => {
+ test('should return assets from both primary and fallback locales', async () => {
if (assets && assets.length && assets[0].length) {
const allAssetsInAllowedLocales = assets[0].every((asset) => {
- return _in.indexOf(asset["publish_details"]["locale"]) !== -1;
+ return _in.indexOf(asset.publish_details.locale) !== -1;
});
expect(allAssetsInAllowedLocales).toBe(true);
} else {
// Skip this test if no assets are returned
- console.warn("No assets returned to verify locales with fallback");
+ console.warn('No assets returned to verify locales with fallback');
}
});
- test("should include some assets in primary locale", async () => {
+ test('should include some assets in primary locale', async () => {
if (assets && assets.length && assets[0].length) {
const anyAssetsInPrimaryLocale = assets[0].some((asset) => {
- return asset["publish_details"]["locale"] === "ja-jp";
+ return asset.publish_details.locale === 'ja-jp';
});
expect(anyAssetsInPrimaryLocale).toBe(true);
} else {
- console.warn("No assets returned to verify primary locale presence");
+ console.warn('No assets returned to verify primary locale presence');
}
});
- test("should have the correct structure for each asset", async () => {
+ test('should have the correct structure for each asset', async () => {
if (assets && assets.length && assets[0].length) {
const firstAsset = assets[0][0];
- expect(firstAsset).toHaveProperty("uid");
- expect(firstAsset).toHaveProperty("title");
- expect(firstAsset).toHaveProperty("publish_details");
- expect(firstAsset.publish_details).toHaveProperty("locale");
+ expect(firstAsset).toHaveProperty('uid');
+ expect(firstAsset).toHaveProperty('title');
+ expect(firstAsset).toHaveProperty('publish_details');
+ expect(firstAsset.publish_details).toHaveProperty('locale');
expect(
- ["ja-jp", "en-us"].includes(firstAsset.publish_details.locale)
+ ['ja-jp', 'en-us'].includes(firstAsset.publish_details.locale)
).toBe(true);
} else {
- console.warn("No assets returned to verify structure");
+ console.warn('No assets returned to verify structure');
}
});
});
- describe("default .find()", () => {
+ describe('default .find()', () => {
let assets;
- const field = "updated_at";
+ const field = 'updated_at';
// Setup - run the query once for all tests
beforeAll(async () => {
@@ -149,23 +149,23 @@ describe("Contentstack Asset Tests", () => {
const Query = Stack.Assets().Query();
assets = await Query.toJSON().find();
} catch (error) {
- console.error("Error in beforeAll:", error);
+ console.error('Error in beforeAll:', error);
throw error;
}
});
- test("should return a non-empty array of assets", async () => {
+ test('should return a non-empty array of assets', async () => {
expect(assets).toBeDefined();
expect(Array.isArray(assets)).toBe(true);
expect(assets[0]).toBeDefined();
expect(assets[0].length).toBeTruthy();
});
- test("should not include count when not requested", async () => {
+ test('should not include count when not requested', async () => {
expect(assets[1]).toBeFalsy();
});
- test("should return assets sorted by updated_at by default in descending order", async () => {
+ test('should return assets sorted by updated_at by default in descending order', async () => {
if (assets && assets.length && assets[0].length) {
let prev = assets[0][0][field];
const allAssetsSorted = assets[0].every((asset) => {
@@ -175,15 +175,15 @@ describe("Contentstack Asset Tests", () => {
});
expect(allAssetsSorted).toBe(true);
} else {
- console.warn("No assets returned to verify sorting");
+ console.warn('No assets returned to verify sorting');
}
});
});
- describe("sorting", () => {
- test(".ascending()", async () => {
+ describe('sorting', () => {
+ test('.ascending()', async () => {
const Query = Stack.Assets().Query();
- const field = "updated_at";
+ const field = 'updated_at';
try {
const assets = await Query.ascending(field).toJSON().find();
@@ -198,14 +198,14 @@ describe("Contentstack Asset Tests", () => {
expect(_assets).toBe(true);
}
} catch (err) {
- console.error("Error:", err);
- fail(".ascending()");
+ console.error('Error:', err);
+ fail('.ascending()');
}
});
- test(".descending()", async () => {
+ test('.descending()', async () => {
const Query = Stack.Assets().Query();
- const field = "created_at";
+ const field = 'created_at';
try {
const assets = await Query.descending(field).toJSON().find();
@@ -221,29 +221,29 @@ describe("Contentstack Asset Tests", () => {
expect(_assets).toBe(true);
}
} catch (err) {
- console.error("Error:", err);
- fail(".descending()");
+ console.error('Error:', err);
+ fail('.descending()');
}
});
});
- test(".addParam()", async () => {
+ test('.addParam()', async () => {
const Query = Stack.Assets().Query();
try {
- const assets = await Query.addParam("include_dimension", "true")
+ const assets = await Query.addParam('include_dimension', 'true')
.toJSON()
.find();
- expect(assets[0][0].hasOwnProperty("dimension")).toBeTruthy();
+ expect(assets[0][0].hasOwnProperty('dimension')).toBeTruthy();
} catch (err) {
- console.error("Error:", err);
- fail(".addParam()");
+ console.error('Error:', err);
+ fail('.addParam()');
}
});
- describe("comparison", () => {
- describe(".lessThan()", () => {
- const field = "file_size";
+ describe('comparison', () => {
+ describe('.lessThan()', () => {
+ const field = 'file_size';
const value = 5122;
let assets;
@@ -252,27 +252,27 @@ describe("Contentstack Asset Tests", () => {
assets = await Query.lessThan(field, value).toJSON().find();
});
- test("should return a non-empty array of assets", async () => {
+ test('should return a non-empty array of assets', async () => {
expect(assets).toBeDefined();
expect(Array.isArray(assets)).toBe(true);
expect(assets[0]).toBeDefined();
expect(assets[0].length).toBeTruthy();
});
- test("should return only assets with file_size less than the specified value", async () => {
+ test('should return only assets with file_size less than the specified value', async () => {
if (assets && assets.length && assets[0].length) {
const allAssetsMatchCondition = assets[0].every(
(asset) => asset[field] < value
);
expect(allAssetsMatchCondition).toBe(true);
} else {
- console.warn("No assets returned to verify lessThan condition");
+ console.warn('No assets returned to verify lessThan condition');
}
});
});
- describe(".lessThanOrEqualTo()", () => {
- const field = "file_size";
+ describe('.lessThanOrEqualTo()', () => {
+ const field = 'file_size';
const value = 5122;
let assets;
@@ -281,14 +281,14 @@ describe("Contentstack Asset Tests", () => {
assets = await Query.lessThanOrEqualTo(field, value).toJSON().find();
});
- test("should return a non-empty array of assets", async () => {
+ test('should return a non-empty array of assets', async () => {
expect(assets).toBeDefined();
expect(Array.isArray(assets)).toBe(true);
expect(assets[0]).toBeDefined();
expect(assets[0].length).toBeTruthy();
});
- test("should return only assets with file_size less than or equal to the specified value", async () => {
+ test('should return only assets with file_size less than or equal to the specified value', async () => {
if (assets && assets.length && assets[0].length) {
const allAssetsMatchCondition = assets[0].every(
(asset) => asset[field] <= value
@@ -296,18 +296,18 @@ describe("Contentstack Asset Tests", () => {
expect(allAssetsMatchCondition).toBe(true);
} else {
console.warn(
- "No assets returned to verify lessThanOrEqualTo condition"
+ 'No assets returned to verify lessThanOrEqualTo condition'
);
}
});
});
- test(".greaterThan()", async () => {
+ test('.greaterThan()', async () => {
const Query = Stack.Assets().Query();
- const field = "file_size";
+ const field = 'file_size';
const value = 5122;
try {
- const assets = await Query.greaterThan("file_size", value)
+ const assets = await Query.greaterThan('file_size', value)
.ascending(field)
.toJSON()
.find();
@@ -324,16 +324,16 @@ describe("Contentstack Asset Tests", () => {
expect(_assets).toBe(true);
}
} catch (err) {
- fail(".greaterThan()");
+ fail('.greaterThan()');
}
});
- test(".greaterThanOrEqualTo()", async () => {
+ test('.greaterThanOrEqualTo()', async () => {
const Query = Stack.Assets().Query();
- const field = "file_size";
+ const field = 'file_size';
const value = 5122;
try {
- const assets = await Query.greaterThanOrEqualTo("file_size", 5122)
+ const assets = await Query.greaterThanOrEqualTo('file_size', 5122)
.descending(field)
.toJSON()
.find();
@@ -350,13 +350,13 @@ describe("Contentstack Asset Tests", () => {
expect(_assets).toBe(true);
}
} catch (err) {
- console.error("Error:", err);
- fail(".greaterThanOrEqualTo()");
+ console.error('Error:', err);
+ fail('.greaterThanOrEqualTo()');
}
});
- describe(".notEqualTo()", () => {
- const field = "file_size";
+ describe('.notEqualTo()', () => {
+ const field = 'file_size';
const value = 5122;
let assets;
@@ -368,101 +368,101 @@ describe("Contentstack Asset Tests", () => {
.find();
});
- test("should return a non-empty array of assets", async () => {
+ test('should return a non-empty array of assets', async () => {
expect(assets).toBeDefined();
expect(Array.isArray(assets)).toBe(true);
expect(assets[0]).toBeDefined();
expect(assets[0].length).toBeTruthy();
});
- test("should return only assets with file_size not equal to the specified value", async () => {
+ test('should return only assets with file_size not equal to the specified value', async () => {
if (assets && assets.length && assets[0].length) {
const allAssetsMatchCondition = assets[0].every(
(asset) => asset[field] !== value
);
expect(allAssetsMatchCondition).toBe(true);
} else {
- console.warn("No assets returned to verify notEqualTo condition");
+ console.warn('No assets returned to verify notEqualTo condition');
}
});
});
- describe(".where()", () => {
- const title = "image1";
+ describe('.where()', () => {
+ const title = 'image1';
let assets;
beforeAll(async () => {
const Query = Stack.Assets().Query();
- assets = await Query.where("title", title).toJSON().find();
+ assets = await Query.where('title', title).toJSON().find();
});
- test("should return a non-empty array of assets", async () => {
+ test('should return a non-empty array of assets', async () => {
expect(assets).toBeDefined();
expect(Array.isArray(assets)).toBe(true);
expect(assets[0]).toBeDefined();
expect(assets[0].length).toBeTruthy();
});
- test("should return exactly one asset matching the title", async () => {
+ test('should return exactly one asset matching the title', async () => {
expect(assets[0].length).toBe(1);
});
- test("should return only assets with the specified title", async () => {
+ test('should return only assets with the specified title', async () => {
if (assets && assets.length && assets[0].length) {
const matchingTitle = assets[0].every(
(asset) => asset.title === title
);
expect(matchingTitle).toBe(true);
} else {
- console.warn("No assets returned to verify where condition");
+ console.warn('No assets returned to verify where condition');
}
});
});
- describe(".equalTo() with boolean values", () => {
- describe("when comparing with false", () => {
+ describe('.equalTo() with boolean values', () => {
+ describe('when comparing with false', () => {
let assets;
beforeAll(async () => {
const Query = Stack.Assets().Query();
- assets = await Query.language("en-us")
- .equalTo("is_dir", false)
+ assets = await Query.language('en-us')
+ .equalTo('is_dir', false)
.toJSON()
.find();
});
- test("should return a non-empty array of assets", async () => {
+ test('should return a non-empty array of assets', async () => {
expect(assets).toBeDefined();
expect(Array.isArray(assets)).toBe(true);
expect(assets[0]).toBeDefined();
expect(assets[0].length).toBeTruthy();
});
- test("should return exactly 5 assets matching the condition", async () => {
+ test('should return exactly 5 assets matching the condition', async () => {
expect(assets[0].length).toBe(5);
});
- test("should return only assets with is_dir set to false", async () => {
+ test('should return only assets with is_dir set to false', async () => {
if (assets && assets.length && assets[0].length) {
const allAssetsMatchCondition = assets[0].every(
(asset) => asset.is_dir === false
);
expect(allAssetsMatchCondition).toBe(true);
} else {
- console.warn("No assets returned to verify equalTo condition");
+ console.warn('No assets returned to verify equalTo condition');
}
});
});
- describe("when comparing with true", () => {
+ describe('when comparing with true', () => {
let assets;
beforeAll(async () => {
const Query = Stack.Assets().Query();
- assets = await Query.equalTo("is_dir", true).toJSON().find();
+ assets = await Query.equalTo('is_dir', true).toJSON().find();
});
- test("should return an empty array of assets", async () => {
+ test('should return an empty array of assets', async () => {
expect(assets).toBeDefined();
expect(Array.isArray(assets)).toBe(true);
expect(assets[0]).toBeDefined();
@@ -472,35 +472,35 @@ describe("Contentstack Asset Tests", () => {
});
});
- describe("Array/Subset Tests", () => {
- describe(".containedIn()", () => {
- const _in = ["image1", "image2"];
+ describe('Array/Subset Tests', () => {
+ describe('.containedIn()', () => {
+ const _in = ['image1', 'image2'];
let assets;
beforeAll(async () => {
const Query = Stack.Assets().Query();
- assets = await Query.containedIn("title", _in).toJSON().find();
+ assets = await Query.containedIn('title', _in).toJSON().find();
});
- test("should return a non-empty array of assets", async () => {
+ test('should return a non-empty array of assets', async () => {
expect(assets).toBeDefined();
expect(Array.isArray(assets)).toBe(true);
expect(assets[0]).toBeDefined();
expect(assets[0].length).toBeTruthy();
});
- test("should return only assets with titles contained in the specified array", async () => {
+ test('should return only assets with titles contained in the specified array', async () => {
if (assets && assets.length && assets[0].length) {
const allAssetsMatchCondition = assets[0].every((asset) => {
- return _in.indexOf(asset["title"]) !== -1;
+ return _in.indexOf(asset.title) !== -1;
});
expect(allAssetsMatchCondition).toBe(true);
} else {
- console.warn("No assets returned to verify containedIn condition");
+ console.warn('No assets returned to verify containedIn condition');
}
});
- test("should include at least one asset with each of the specified titles", async () => {
+ test('should include at least one asset with each of the specified titles', async () => {
if (assets && assets.length && assets[0].length) {
// Check if at least one asset exists for each title in the array
const foundTitles = _in.filter((title) =>
@@ -508,56 +508,56 @@ describe("Contentstack Asset Tests", () => {
);
expect(foundTitles.length).toBe(_in.length);
} else {
- console.warn("No assets returned to verify all titles are present");
+ console.warn('No assets returned to verify all titles are present');
}
});
});
- describe(".notContainedIn()", () => {
- const _in = ["image1", "image2"];
+ describe('.notContainedIn()', () => {
+ const _in = ['image1', 'image2'];
let assets;
beforeAll(async () => {
const Query = Stack.Assets().Query();
- assets = await Query.notContainedIn("title", _in).toJSON().find();
+ assets = await Query.notContainedIn('title', _in).toJSON().find();
});
- test("should return a non-empty array of assets", async () => {
+ test('should return a non-empty array of assets', async () => {
expect(assets).toBeDefined();
expect(Array.isArray(assets)).toBe(true);
expect(assets[0]).toBeDefined();
expect(assets[0].length).toBeTruthy();
});
- test("should return only assets with titles not contained in the specified array", async () => {
+ test('should return only assets with titles not contained in the specified array', async () => {
if (assets && assets.length && assets[0].length) {
const allAssetsMatchCondition = assets[0].every((asset) => {
- return _in.indexOf(asset["title"]) === -1;
+ return _in.indexOf(asset.title) === -1;
});
expect(allAssetsMatchCondition).toBe(true);
} else {
- console.warn("No assets returned to verify notContainedIn condition");
+ console.warn('No assets returned to verify notContainedIn condition');
}
});
- test("should not include any assets with the specified titles", async () => {
+ test('should not include any assets with the specified titles', async () => {
if (assets && assets.length && assets[0].length) {
const foundForbiddenTitles = assets[0].filter((asset) =>
_in.includes(asset.title)
);
expect(foundForbiddenTitles.length).toBe(0);
} else {
- console.warn("No assets returned to verify excluded titles");
+ console.warn('No assets returned to verify excluded titles');
}
});
});
});
- describe("Element Existence Tests", () => {
- test(".exists()", async () => {
+ describe('Element Existence Tests', () => {
+ test('.exists()', async () => {
const Query = Stack.Assets().Query();
- const queryField = "is_dir";
- const field = "updated_at";
+ const queryField = 'is_dir';
+ const field = 'updated_at';
try {
const assets = await Query.exists(queryField).toJSON().find();
@@ -573,38 +573,38 @@ describe("Contentstack Asset Tests", () => {
expect(_assets).toBe(true);
}
} catch (err) {
- console.error("Error:", err);
- fail(".exists()");
+ console.error('Error:', err);
+ fail('.exists()');
}
});
- test(".notExists()", async () => {
+ test('.notExists()', async () => {
const Query = Stack.Assets().Query();
- const queryField = "is_dir";
- const field = "updated_at";
+ const queryField = 'is_dir';
+ const field = 'updated_at';
try {
const assets = await Query.notExists(queryField).toJSON().find();
expect(assets[0].length).toBeFalsy();
if (assets && assets.length && assets[0].length) {
- let prev = assets[0][0][field];
+ const prev = assets[0][0][field];
const _assets = assets[0].every((asset) => {
return asset[field] <= prev;
});
expect(_assets).toBe(true);
}
} catch (err) {
- console.error("Error:", err);
- fail(".notExists()");
+ console.error('Error:', err);
+ fail('.notExists()');
}
});
});
- describe("Pagination Tests", () => {
- test(".skip()", async () => {
+ describe('Pagination Tests', () => {
+ test('.skip()', async () => {
const Query = Stack.Assets().Query();
- const field = "updated_at";
+ const field = 'updated_at';
try {
const allassets = await Query.toJSON().find();
const assets = await Stack.Assets().Query().skip(1).toJSON().find();
@@ -622,14 +622,14 @@ describe("Contentstack Asset Tests", () => {
expect(_assets).toBe(true);
}
} catch (err) {
- console.error("Error:", err);
- fail(".skip()");
+ console.error('Error:', err);
+ fail('.skip()');
}
});
- test(".limit()", async () => {
+ test('.limit()', async () => {
const Query = Stack.Assets().Query();
- const field = "updated_at";
+ const field = 'updated_at';
try {
const allassets = await Query.toJSON().find();
const assets = await Stack.Assets().Query().limit(2).toJSON().find();
@@ -647,86 +647,86 @@ describe("Contentstack Asset Tests", () => {
expect(_assets).toBe(true);
}
} catch (err) {
- console.error("Error:", err);
- fail(".limit()");
+ console.error('Error:', err);
+ fail('.limit()');
}
});
- test(".count()", async () => {
+ test('.count()', async () => {
const Query = Stack.Assets().Query();
try {
const count = await Query.count().toJSON().find();
expect(count).toBeTruthy();
} catch (err) {
- console.error("Error:", err);
- fail(".count()");
+ console.error('Error:', err);
+ fail('.count()');
}
});
});
- describe("Logical Operators Tests", () => {
- describe(".or() - Query Objects", () => {
+ describe('Logical Operators Tests', () => {
+ describe('.or() - Query Objects', () => {
let assets;
- const title = "image1";
+ const title = 'image1';
const isDir = true;
beforeAll(async () => {
- const Query1 = Stack.Assets().Query().where("title", title);
- const Query2 = Stack.Assets().Query().where("is_dir", isDir);
+ const Query1 = Stack.Assets().Query().where('title', title);
+ const Query2 = Stack.Assets().Query().where('is_dir', isDir);
const Query = Stack.Assets().Query();
assets = await Query.or(Query1, Query2).toJSON().find();
});
- test("should return a non-empty array of assets", async () => {
+ test('should return a non-empty array of assets', async () => {
expect(assets).toBeDefined();
expect(Array.isArray(assets)).toBe(true);
expect(assets[0]).toBeDefined();
expect(assets[0].length).toBeTruthy();
});
- test("should return only assets matching at least one of the specified conditions", async () => {
+ test('should return only assets matching at least one of the specified conditions', async () => {
if (assets && assets.length && assets[0].length) {
const allAssetsMatchCondition = assets[0].every(
(asset) => asset.title === title || asset.is_dir === isDir
);
expect(allAssetsMatchCondition).toBe(true);
} else {
- console.warn("No assets returned to verify OR condition");
+ console.warn('No assets returned to verify OR condition');
}
});
- test("should include at least one asset matching the title condition", async () => {
+ test('should include at least one asset matching the title condition', async () => {
if (assets && assets.length && assets[0].length) {
const anyAssetMatchesTitleCondition = assets[0].some(
(asset) => asset.title === title
);
expect(anyAssetMatchesTitleCondition).toBe(true);
} else {
- console.warn("No assets returned to verify first condition");
+ console.warn('No assets returned to verify first condition');
}
});
});
- describe(".and() - Query Objects", () => {
+ describe('.and() - Query Objects', () => {
let assets;
- const title = "image1";
+ const title = 'image1';
const isDir = true;
beforeAll(async () => {
- const Query1 = Stack.Assets().Query().where("title", title);
- const Query2 = Stack.Assets().Query().where("is_dir", isDir);
+ const Query1 = Stack.Assets().Query().where('title', title);
+ const Query2 = Stack.Assets().Query().where('is_dir', isDir);
const Query = Stack.Assets().Query();
assets = await Query.and(Query1, Query2).toJSON().find();
});
- test("should return an empty array when conditions cannot be satisfied simultaneously", async () => {
+ test('should return an empty array when conditions cannot be satisfied simultaneously', async () => {
expect(assets).toBeDefined();
expect(Array.isArray(assets)).toBe(true);
expect(assets[0]).toBeDefined();
expect(assets[0].length).toBeFalsy();
});
- test("should verify that no assets match both conditions", async () => {
+ test('should verify that no assets match both conditions', async () => {
if (assets && assets.length && assets[0].length) {
const allAssetsMatchCondition = assets[0].every(
(asset) => asset.title === title && asset.is_dir === isDir
@@ -736,84 +736,84 @@ describe("Contentstack Asset Tests", () => {
});
});
- describe(".query() - Raw query", () => {
+ describe('.query() - Raw query', () => {
let assets;
- const title = "image2";
+ const title = 'image2';
const isDir = true;
beforeAll(async () => {
const Query = Stack.Assets().Query();
assets = await Query.query({
- $or: [{ title: title }, { is_dir: isDir }],
+ $or: [{ title }, { is_dir: isDir }]
})
.toJSON()
.find();
});
- test("should return a non-empty array of assets", async () => {
+ test('should return a non-empty array of assets', async () => {
expect(assets).toBeDefined();
expect(Array.isArray(assets)).toBe(true);
expect(assets[0]).toBeDefined();
expect(assets[0].length).toBeTruthy();
});
- test("should return only assets matching at least one of the specified conditions", async () => {
+ test('should return only assets matching at least one of the specified conditions', async () => {
if (assets && assets.length && assets[0].length) {
const allAssetsMatchCondition = assets[0].every(
(asset) => asset.title === title || asset.is_dir === isDir
);
expect(allAssetsMatchCondition).toBe(true);
} else {
- console.warn("No assets returned to verify raw query conditions");
+ console.warn('No assets returned to verify raw query conditions');
}
});
- test("should include at least one asset matching the title condition", async () => {
+ test('should include at least one asset matching the title condition', async () => {
if (assets && assets.length && assets[0].length) {
const anyAssetMatchesTitleCondition = assets[0].some(
(asset) => asset.title === title
);
expect(anyAssetMatchesTitleCondition).toBe(true);
} else {
- console.warn("No assets returned to verify first condition");
+ console.warn('No assets returned to verify first condition');
}
});
});
});
- describe("Tags Tests", () => {
- describe(".tags() - empty results", () => {
+ describe('Tags Tests', () => {
+ describe('.tags() - empty results', () => {
let assets;
- const tags = ["asset3"];
+ const tags = ['asset3'];
beforeAll(async () => {
const Query = Stack.Assets().Query();
assets = await Query.tags(tags).toJSON().find();
});
- test("should return a properly structured response", async () => {
+ test('should return a properly structured response', async () => {
expect(assets).toBeDefined();
expect(Array.isArray(assets)).toBe(true);
expect(assets.length).toBeGreaterThanOrEqual(1);
});
- test("should return an empty array when no assets match the tags", async () => {
+ test('should return an empty array when no assets match the tags', async () => {
expect(assets[0]).toBeDefined();
expect(assets[0].length).toBe(0);
});
});
- describe(".tags() - with results", () => {
+ describe('.tags() - with results', () => {
let assets;
- const field = "tags";
- const tags = ["asset1", "asset2"];
+ const field = 'tags';
+ const tags = ['asset1', 'asset2'];
beforeAll(async () => {
const Query = Stack.Assets().Query();
assets = await Query.tags(tags).toJSON().find();
});
- test("should return a non-empty array of assets", async () => {
+ test('should return a non-empty array of assets', async () => {
expect(assets).toBeDefined();
expect(Array.isArray(assets)).toBe(true);
expect(assets.length).toBeGreaterThanOrEqual(1);
@@ -821,18 +821,18 @@ describe("Contentstack Asset Tests", () => {
expect(assets[0].length).toBeTruthy();
});
- test("should return only assets with at least one matching tag", async () => {
+ test('should return only assets with at least one matching tag', async () => {
if (assets && assets.length && assets[0].length) {
const allAssetsHaveMatchingTags = assets[0].every((asset) => {
return Utils.arrayPresentInArray(tags, asset[field]);
});
expect(allAssetsHaveMatchingTags).toBe(true);
} else {
- console.warn("No assets returned to verify tags");
+ console.warn('No assets returned to verify tags');
}
});
- test("should include assets with tags that overlap with the specified tags", async () => {
+ test('should include assets with tags that overlap with the specified tags', async () => {
if (assets && assets.length && assets[0].length) {
const allAssetsHaveOverlappingTags = assets[0].every((asset) => {
// Check that asset tags overlap with requested tags
@@ -840,30 +840,30 @@ describe("Contentstack Asset Tests", () => {
});
expect(allAssetsHaveOverlappingTags).toBe(true);
} else {
- console.warn("No assets returned to verify tag overlap");
+ console.warn('No assets returned to verify tag overlap');
}
});
});
});
- describe("Search Tests", () => {
- describe(".search()", () => {
+ describe('Search Tests', () => {
+ describe('.search()', () => {
let assets;
- const searchTerm = "image1";
+ const searchTerm = 'image1';
beforeAll(async () => {
const Query = Stack.Assets().Query();
assets = await Query.toJSON().search(searchTerm).find();
});
- test("should return a non-empty array of assets", async () => {
+ test('should return a non-empty array of assets', async () => {
expect(assets).toBeDefined();
expect(Array.isArray(assets)).toBe(true);
expect(assets[0]).toBeDefined();
expect(assets[0].length).toBeTruthy();
});
- test("should return assets matching the search term", async () => {
+ test('should return assets matching the search term', async () => {
if (assets && assets.length && assets[0].length) {
// Verify that each asset contains the search term in some field
// This is a simplified check since search can match across multiple fields
@@ -874,17 +874,17 @@ describe("Contentstack Asset Tests", () => {
);
expect(anyAssetMatchesSearchTerm).toBe(true);
} else {
- console.warn("No assets returned to verify search results");
+ console.warn('No assets returned to verify search results');
}
});
});
- describe(".regex()", () => {
+ describe('.regex()', () => {
let assets;
- const field = "title";
+ const field = 'title';
const regex = {
- pattern: "^image",
- options: "i",
+ pattern: '^image',
+ options: 'i'
};
const regexpObj = new RegExp(regex.pattern, regex.options);
@@ -895,7 +895,7 @@ describe("Contentstack Asset Tests", () => {
.find();
});
- test("should return a non-empty array of assets", async () => {
+ test('should return a non-empty array of assets', async () => {
expect(assets).toBeDefined();
expect(Array.isArray(assets)).toBe(true);
expect(assets.length).toBeGreaterThanOrEqual(1);
@@ -903,32 +903,32 @@ describe("Contentstack Asset Tests", () => {
expect(assets[0].length).toBeTruthy();
});
- test("should return only assets with titles matching the regex pattern", async () => {
+ test('should return only assets with titles matching the regex pattern', async () => {
if (assets && assets.length && assets[0].length) {
const allAssetsTitlesMatchRegex = assets[0].every((asset) => {
return regexpObj.test(asset[field]);
});
expect(allAssetsTitlesMatchRegex).toBe(true);
} else {
- console.warn("No assets returned to verify regex match");
+ console.warn('No assets returned to verify regex match');
}
});
test('should include assets whose titles start with "image"', async () => {
if (assets && assets.length && assets[0].length) {
const allTitlesStartWithImage = assets[0].every((asset) =>
- asset.title.toLowerCase().startsWith("image")
+ asset.title.toLowerCase().startsWith('image')
);
expect(allTitlesStartWithImage).toBe(true);
} else {
- console.warn("No assets returned to verify specific regex pattern");
+ console.warn('No assets returned to verify specific regex pattern');
}
});
});
});
- describe("Include Options", () => {
- describe(".includeCount()", () => {
+ describe('Include Options', () => {
+ describe('.includeCount()', () => {
let assets;
beforeAll(async () => {
@@ -936,82 +936,82 @@ describe("Contentstack Asset Tests", () => {
assets = await Query.includeCount().toJSON().find();
});
- test("should return a non-empty array of assets", async () => {
+ test('should return a non-empty array of assets', async () => {
expect(assets).toBeDefined();
expect(Array.isArray(assets)).toBe(true);
expect(assets[0]).toBeDefined();
expect(assets[0].length).toBeTruthy();
});
- test("should include count information in the result", async () => {
+ test('should include count information in the result', async () => {
expect(assets[1]).toBeDefined();
expect(assets[1]).toBeTruthy();
});
- test("should return count as a number", async () => {
- expect(typeof assets[1]).toBe("number");
+ test('should return count as a number', async () => {
+ expect(typeof assets[1]).toBe('number');
});
- test("should return count equal to the number of returned assets", async () => {
+ test('should return count equal to the number of returned assets', async () => {
expect(assets[1]).toBeGreaterThanOrEqual(assets[0].length);
});
});
});
- describe("Field Projections", () => {
- describe(".only() - Single String Parameter", () => {
+ describe('Field Projections', () => {
+ describe('.only() - Single String Parameter', () => {
let assets;
- const selectedField = "title";
+ const selectedField = 'title';
beforeAll(async () => {
const Query = Stack.Assets().Query();
assets = await Query.only(selectedField).toJSON().find();
});
- test("should return a non-empty array of assets", async () => {
+ test('should return a non-empty array of assets', async () => {
expect(assets).toBeDefined();
expect(Array.isArray(assets)).toBe(true);
expect(assets[0]).toBeDefined();
expect(assets[0].length).toBeTruthy();
});
- test("should include the selected field in each asset", async () => {
+ test('should include the selected field in each asset', async () => {
if (assets && assets.length && assets[0].length) {
const allAssetsHaveSelectedField = assets[0].every(
(asset) => selectedField in asset
);
expect(allAssetsHaveSelectedField).toBe(true);
} else {
- console.warn("No assets returned to verify field projection");
+ console.warn('No assets returned to verify field projection');
}
});
- test("should include system fields along with the selected field", async () => {
+ test('should include system fields along with the selected field', async () => {
if (assets && assets.length && assets[0].length) {
const allAssetsHaveRequiredFields = assets[0].every(
- (asset) => "title" in asset && "uid" in asset && "url" in asset
+ (asset) => 'title' in asset && 'uid' in asset && 'url' in asset
);
expect(allAssetsHaveRequiredFields).toBe(true);
} else {
- console.warn("No assets returned to verify system fields");
+ console.warn('No assets returned to verify system fields');
}
});
- test("should limit the total number of fields in each asset", async () => {
+ test('should limit the total number of fields in each asset', async () => {
if (assets && assets.length && assets[0].length) {
const allAssetsHaveLimitedFields = assets[0].every(
(asset) => Object.keys(asset).length === 5
);
expect(allAssetsHaveLimitedFields).toBe(true);
} else {
- console.warn("No assets returned to verify field count");
+ console.warn('No assets returned to verify field count');
}
});
});
- describe(".only() - Multiple String Parameters", () => {
+ describe('.only() - Multiple String Parameters', () => {
let assets;
- const selectedFields = ["BASE", "title"];
+ const selectedFields = ['BASE', 'title'];
beforeAll(async () => {
const Query = Stack.Assets().Query();
@@ -1020,93 +1020,93 @@ describe("Contentstack Asset Tests", () => {
.find();
});
- test("should return a non-empty array of assets", async () => {
+ test('should return a non-empty array of assets', async () => {
expect(assets).toBeDefined();
expect(Array.isArray(assets)).toBe(true);
expect(assets[0]).toBeDefined();
expect(assets[0].length).toBeTruthy();
});
- test("should include the title field in each asset", async () => {
+ test('should include the title field in each asset', async () => {
if (assets && assets.length && assets[0].length) {
const allAssetsHaveTitle = assets[0].every(
- (asset) => "title" in asset
+ (asset) => 'title' in asset
);
expect(allAssetsHaveTitle).toBe(true);
} else {
- console.warn("No assets returned to verify field projection");
+ console.warn('No assets returned to verify field projection');
}
});
- test("should include system fields in each asset", async () => {
+ test('should include system fields in each asset', async () => {
if (assets && assets.length && assets[0].length) {
const allAssetsHaveSystemFields = assets[0].every(
- (asset) => "uid" in asset && "url" in asset
+ (asset) => 'uid' in asset && 'url' in asset
);
expect(allAssetsHaveSystemFields).toBe(true);
} else {
- console.warn("No assets returned to verify system fields");
+ console.warn('No assets returned to verify system fields');
}
});
- test("should limit the total number of fields in each asset", async () => {
+ test('should limit the total number of fields in each asset', async () => {
if (assets && assets.length && assets[0].length) {
const allAssetsHaveLimitedFields = assets[0].every(
(asset) => Object.keys(asset).length === 5
);
expect(allAssetsHaveLimitedFields).toBe(true);
} else {
- console.warn("No assets returned to verify field count");
+ console.warn('No assets returned to verify field count');
}
});
});
- describe(".only() - Array Parameter", () => {
+ describe('.only() - Array Parameter', () => {
let assets;
- const selectedFields = ["title", "filename"];
+ const selectedFields = ['title', 'filename'];
beforeAll(async () => {
const Query = Stack.Assets().Query();
assets = await Query.only(selectedFields).toJSON().find();
});
- test("should return a non-empty array of assets", async () => {
+ test('should return a non-empty array of assets', async () => {
expect(assets).toBeDefined();
expect(Array.isArray(assets)).toBe(true);
expect(assets[0]).toBeDefined();
expect(assets[0].length).toBeTruthy();
});
- test("should include all the selected fields in each asset", async () => {
+ test('should include all the selected fields in each asset', async () => {
if (assets && assets.length && assets[0].length) {
const allAssetsHaveSelectedFields = assets[0].every((asset) =>
selectedFields.every((field) => field in asset)
);
expect(allAssetsHaveSelectedFields).toBe(true);
} else {
- console.warn("No assets returned to verify field projection");
+ console.warn('No assets returned to verify field projection');
}
});
- test("should include system fields in each asset", async () => {
+ test('should include system fields in each asset', async () => {
if (assets && assets.length && assets[0].length) {
const allAssetsHaveSystemFields = assets[0].every(
- (asset) => "uid" in asset && "url" in asset
+ (asset) => 'uid' in asset && 'url' in asset
);
expect(allAssetsHaveSystemFields).toBe(true);
} else {
- console.warn("No assets returned to verify system fields");
+ console.warn('No assets returned to verify system fields');
}
});
- test("should limit the total number of fields in each asset", async () => {
+ test('should limit the total number of fields in each asset', async () => {
if (assets && assets.length && assets[0].length) {
const allAssetsHaveLimitedFields = assets[0].every(
(asset) => Object.keys(asset).length === 5
);
expect(allAssetsHaveLimitedFields).toBe(true);
} else {
- console.warn("No assets returned to verify field count");
+ console.warn('No assets returned to verify field count');
}
});
});
diff --git a/test/asset/find.js b/test/asset/find.js
index ea2aee3c..09935d50 100755
--- a/test/asset/find.js
+++ b/test/asset/find.js
@@ -1,14 +1,14 @@
-"use strict";
+'use strict';
/*
* Module Dependencies.
*/
-const Contentstack = require("../../dist/node/contentstack.js");
-const init = require("../config.js");
-const Utils = require("../entry/utils.js");
+const Contentstack = require('../../dist/node/contentstack.js');
+const init = require('../config.js');
+const Utils = require('../entry/utils.js');
let Stack;
-describe("Contentstack Asset Tests", () => {
+describe('Contentstack Asset Tests', () => {
// Initialize the Contentstack Stack Instance
beforeAll(() => {
return new Promise((resolve) => {
@@ -18,13 +18,13 @@ describe("Contentstack Asset Tests", () => {
});
});
- describe("Language and Fallback Tests", () => {
- test("default .find() No fallback", async () => {
- const _in = ["ja-jp"];
+ describe('Language and Fallback Tests', () => {
+ test('default .find() No fallback', async () => {
+ const _in = ['ja-jp'];
const assets = await Stack.Assets()
.Query()
- .language("ja-jp")
+ .language('ja-jp')
.toJSON()
.find();
@@ -33,18 +33,18 @@ describe("Contentstack Asset Tests", () => {
if (assets && assets.length && assets[0].length) {
const _assets = assets[0].every((asset) => {
- return _in.indexOf(asset["publish_details"]["locale"]) !== -1;
+ return _in.indexOf(asset.publish_details.locale) !== -1;
});
expect(_assets).toBe(true);
}
});
- test("default .find() fallback", async () => {
- const _in = ["ja-jp", "en-us"];
+ test('default .find() fallback', async () => {
+ const _in = ['ja-jp', 'en-us'];
const assets = await Stack.Assets()
.Query()
- .language("ja-jp")
+ .language('ja-jp')
.includeFallback()
.toJSON()
.find();
@@ -54,16 +54,16 @@ describe("Contentstack Asset Tests", () => {
if (assets && assets.length && assets[0].length) {
const _assets = assets[0].every((asset) => {
- return _in.indexOf(asset["publish_details"]["locale"]) !== -1;
+ return _in.indexOf(asset.publish_details.locale) !== -1;
});
expect(_assets).toBe(true);
}
});
});
- test("default .find()", async () => {
+ test('default .find()', async () => {
const Query = Stack.Assets().Query();
- const field = "updated_at";
+ const field = 'updated_at';
const assets = await Query.toJSON().find();
expect(assets[0].length).toBeTruthy();
@@ -80,10 +80,10 @@ describe("Contentstack Asset Tests", () => {
}
});
- describe("Sorting", () => {
- test(".ascending()", async () => {
+ describe('Sorting', () => {
+ test('.ascending()', async () => {
const Query = Stack.Assets().Query();
- const field = "updated_at";
+ const field = 'updated_at';
const assets = await Query.ascending(field).toJSON().find();
@@ -100,9 +100,9 @@ describe("Contentstack Asset Tests", () => {
}
});
- test(".descending()", async () => {
+ test('.descending()', async () => {
const Query = Stack.Assets().Query();
- const field = "created_at";
+ const field = 'created_at';
const assets = await Query.descending(field).toJSON().find();
@@ -120,24 +120,24 @@ describe("Contentstack Asset Tests", () => {
});
});
- describe("Params", () => {
- test(".addParam()", async () => {
+ describe('Params', () => {
+ test('.addParam()', async () => {
const Query = Stack.Assets().Query();
- const assets = await Query.addParam("include_dimension", "true")
+ const assets = await Query.addParam('include_dimension', 'true')
.toJSON()
.find();
- expect(assets[0][0].hasOwnProperty("dimension")).toBeTruthy();
+ expect(assets[0][0].hasOwnProperty('dimension')).toBeTruthy();
});
});
- describe("Comparison", () => {
- test(".lessThan()", async () => {
+ describe('Comparison', () => {
+ test('.lessThan()', async () => {
const Query = Stack.Assets().Query();
- const field = "file_size";
+ const field = 'file_size';
const value = 5122;
- const assets = await Query.lessThan("file_size", value).toJSON().find();
+ const assets = await Query.lessThan('file_size', value).toJSON().find();
expect(assets[0].length).toBeTruthy();
@@ -152,11 +152,11 @@ describe("Contentstack Asset Tests", () => {
}
});
- test(".lessThanOrEqualTo()", async () => {
+ test('.lessThanOrEqualTo()', async () => {
const Query = Stack.Assets().Query();
- const field = "updated_at";
+ const field = 'updated_at';
- const assets = await Query.lessThanOrEqualTo("file_size", 5122)
+ const assets = await Query.lessThanOrEqualTo('file_size', 5122)
.toJSON()
.find();
@@ -173,12 +173,12 @@ describe("Contentstack Asset Tests", () => {
}
});
- test(".greaterThan()", async () => {
+ test('.greaterThan()', async () => {
const Query = Stack.Assets().Query();
- const field = "file_size";
+ const field = 'file_size';
const value = 5122;
- const assets = await Query.greaterThan("file_size", value)
+ const assets = await Query.greaterThan('file_size', value)
.ascending(field)
.toJSON()
.find();
@@ -196,12 +196,12 @@ describe("Contentstack Asset Tests", () => {
}
});
- test(".greaterThanOrEqualTo()", async () => {
+ test('.greaterThanOrEqualTo()', async () => {
const Query = Stack.Assets().Query();
- const field = "file_size";
+ const field = 'file_size';
const value = 5122;
- const assets = await Query.greaterThanOrEqualTo("file_size", value)
+ const assets = await Query.greaterThanOrEqualTo('file_size', value)
.descending(field)
.toJSON()
.find();
@@ -219,12 +219,12 @@ describe("Contentstack Asset Tests", () => {
}
});
- test(".notEqualTo()", async () => {
+ test('.notEqualTo()', async () => {
const Query = Stack.Assets().Query();
- const field = "file_size";
+ const field = 'file_size';
const value = 5122;
- const assets = await Query.notEqualTo("file_size", value)
+ const assets = await Query.notEqualTo('file_size', value)
.descending(field)
.toJSON()
.find();
@@ -242,20 +242,20 @@ describe("Contentstack Asset Tests", () => {
}
});
- test(".where()", async () => {
+ test('.where()', async () => {
const Query = Stack.Assets().Query();
- const assets = await Query.where("title", "image1").toJSON().find();
+ const assets = await Query.where('title', 'image1').toJSON().find();
expect(assets[0].length).toBeTruthy();
expect(assets[0].length).toBe(1);
});
- test(".equalTo() compare boolean value (true)", async () => {
+ test('.equalTo() compare boolean value (true)', async () => {
const Query = Stack.Assets().Query();
- const assets = await Query.language("en-us")
- .equalTo("is_dir", false)
+ const assets = await Query.language('en-us')
+ .equalTo('is_dir', false)
.toJSON()
.find();
@@ -263,49 +263,49 @@ describe("Contentstack Asset Tests", () => {
expect(assets[0].length).toBe(5);
});
- test(".equalTo() compare boolean value (false)", async () => {
+ test('.equalTo() compare boolean value (false)', async () => {
const Query = Stack.Assets().Query();
- const assets = await Query.equalTo("is_dir", true).toJSON().find();
+ const assets = await Query.equalTo('is_dir', true).toJSON().find();
expect(assets[0].length).toBeFalsy();
expect(assets[0].length).toBe(0);
});
});
- describe("Array/Subset Tests", () => {
- test(".containedIn()", async () => {
+ describe('Array/Subset Tests', () => {
+ test('.containedIn()', async () => {
const Query = Stack.Assets().Query();
- const _in = ["image1", "image2"];
- const field = "updated_at";
+ const _in = ['image1', 'image2'];
+ const field = 'updated_at';
- const assets = await Query.containedIn("title", _in).toJSON().find();
+ const assets = await Query.containedIn('title', _in).toJSON().find();
expect(assets[0].length).toBeTruthy();
if (assets && assets.length && assets[0].length) {
const _assets = assets[0].every((asset) => {
- return _in.indexOf(asset["title"]) != -1;
+ return _in.indexOf(asset.title) != -1;
});
expect(_assets).toBe(true);
}
});
- test(".notContainedIn()", async () => {
+ test('.notContainedIn()', async () => {
const Query = Stack.Assets().Query();
- const _in = ["image1", "image2"];
+ const _in = ['image1', 'image2'];
- const assets = await Query.notContainedIn("title", _in).toJSON().find();
+ const assets = await Query.notContainedIn('title', _in).toJSON().find();
expect(assets[0].length).toBeTruthy();
});
});
- describe("Element Existence Tests", () => {
- test(".exists()", async () => {
+ describe('Element Existence Tests', () => {
+ test('.exists()', async () => {
const Query = Stack.Assets().Query();
- const queryField = "is_dir";
- const field = "updated_at";
+ const queryField = 'is_dir';
+ const field = 'updated_at';
const assets = await Query.exists(queryField).toJSON().find();
@@ -322,17 +322,17 @@ describe("Contentstack Asset Tests", () => {
}
});
- test(".notExists()", async () => {
+ test('.notExists()', async () => {
const Query = Stack.Assets().Query();
- const queryField = "is_dir";
- const field = "updated_at";
+ const queryField = 'is_dir';
+ const field = 'updated_at';
const assets = await Query.notExists(queryField).toJSON().find();
expect(assets[0].length).toBeFalsy();
if (assets && assets.length && assets[0].length) {
- let prev = assets[0][0][field];
+ const prev = assets[0][0][field];
const _assets = assets[0].every((asset) => {
return asset[field] <= prev;
});
@@ -341,10 +341,10 @@ describe("Contentstack Asset Tests", () => {
});
});
- describe("Pagination Tests", () => {
- test(".skip()", async () => {
+ describe('Pagination Tests', () => {
+ test('.skip()', async () => {
const Query = Stack.Assets().Query();
- const field = "updated_at";
+ const field = 'updated_at';
const allassets = await Query.toJSON().find();
const assets = await Stack.Assets().Query().skip(1).toJSON().find();
@@ -363,9 +363,9 @@ describe("Contentstack Asset Tests", () => {
}
});
- test(".limit()", async () => {
+ test('.limit()', async () => {
const Query = Stack.Assets().Query();
- const field = "updated_at";
+ const field = 'updated_at';
const allassets = await Query.toJSON().find();
const assets = await Stack.Assets().Query().limit(2).toJSON().find();
@@ -384,7 +384,7 @@ describe("Contentstack Asset Tests", () => {
}
});
- test(".count()", async () => {
+ test('.count()', async () => {
const Query = Stack.Assets().Query();
const count = await Query.count().toJSON().find();
@@ -392,10 +392,10 @@ describe("Contentstack Asset Tests", () => {
});
});
- describe("Logical Operators Tests", () => {
- test(".or() - Query Objects", async () => {
- const Query1 = Stack.Assets().Query().where("title", "image1");
- const Query2 = Stack.Assets().Query().where("is_dir", true);
+ describe('Logical Operators Tests', () => {
+ test('.or() - Query Objects', async () => {
+ const Query1 = Stack.Assets().Query().where('title', 'image1');
+ const Query2 = Stack.Assets().Query().where('is_dir', true);
const Query = Stack.Assets().Query();
const assets = await Query.or(Query1, Query2).toJSON().find();
@@ -404,15 +404,15 @@ describe("Contentstack Asset Tests", () => {
if (assets && assets.length && assets[0].length) {
const _assets = assets[0].every((asset) => {
- return ~(asset.title === "source1" || asset.is_dir === true);
+ return ~(asset.title === 'source1' || asset.is_dir === true);
});
expect(_assets).toBeTruthy();
}
});
- test(".and() - Query Objects", async () => {
- const Query1 = Stack.Assets().Query().where("title", "image1");
- const Query2 = Stack.Assets().Query().where("is_dir", true);
+ test('.and() - Query Objects', async () => {
+ const Query1 = Stack.Assets().Query().where('title', 'image1');
+ const Query2 = Stack.Assets().Query().where('is_dir', true);
const Query = Stack.Assets().Query();
const assets = await Query.and(Query1, Query2).toJSON().find();
@@ -421,17 +421,17 @@ describe("Contentstack Asset Tests", () => {
if (assets && assets.length && assets[0].length) {
const _assets = assets[0].every((asset) => {
- return ~(asset.title === "image1" && asset.is_dir === true);
+ return ~(asset.title === 'image1' && asset.is_dir === true);
});
expect(_assets).toBeTruthy();
}
});
- test(".query() - Raw query", async () => {
+ test('.query() - Raw query', async () => {
const Query = Stack.Assets().Query();
const assets = await Query.query({
- $or: [{ title: "image2" }, { is_dir: "true" }],
+ $or: [{ title: 'image2' }, { is_dir: 'true' }]
})
.toJSON()
.find();
@@ -440,17 +440,17 @@ describe("Contentstack Asset Tests", () => {
if (assets && assets.length && assets[0].length) {
const _assets = assets[0].every((asset) => {
- return asset.title === "image2" || asset.is_dir === false;
+ return asset.title === 'image2' || asset.is_dir === false;
});
expect(_assets).toBeTruthy();
}
});
});
- describe("Tags Tests", () => {
- test(".tags() - empty results", async () => {
+ describe('Tags Tests', () => {
+ test('.tags() - empty results', async () => {
const Query = Stack.Assets().Query();
- const tags = ["asset3"];
+ const tags = ['asset3'];
const assets = await Query.tags(tags).toJSON().find();
@@ -461,10 +461,10 @@ describe("Contentstack Asset Tests", () => {
}
});
- test(".tags() - with results", async () => {
+ test('.tags() - with results', async () => {
const Query = Stack.Assets().Query();
- const field = "tags";
- const tags = ["asset1", "asset2"];
+ const field = 'tags';
+ const tags = ['asset1', 'asset2'];
const assets = await Query.tags(tags).toJSON().find();
@@ -479,20 +479,20 @@ describe("Contentstack Asset Tests", () => {
});
});
- describe("Search Tests", () => {
- test(".search()", async () => {
+ describe('Search Tests', () => {
+ test('.search()', async () => {
const Query = Stack.Assets().Query();
- const assets = await Query.toJSON().search("image1").find();
+ const assets = await Query.toJSON().search('image1').find();
expect(assets[0].length).toBeTruthy();
});
- test(".regex()", async () => {
+ test('.regex()', async () => {
const Query = Stack.Assets().Query();
- const field = "title";
+ const field = 'title';
const regex = {
- pattern: "^image",
- options: "i",
+ pattern: '^image',
+ options: 'i'
};
const regexpObj = new RegExp(regex.pattern, regex.options);
@@ -509,8 +509,8 @@ describe("Contentstack Asset Tests", () => {
});
});
- describe("Include Options", () => {
- test(".includeCount()", async () => {
+ describe('Include Options', () => {
+ test('.includeCount()', async () => {
const Query = Stack.Assets().Query();
const assets = await Query.includeCount().toJSON().find();
@@ -520,11 +520,11 @@ describe("Contentstack Asset Tests", () => {
});
});
- describe("Field Projections", () => {
- test(".only() - Single String Parameter", async () => {
+ describe('Field Projections', () => {
+ test('.only() - Single String Parameter', async () => {
const Query = Stack.Assets().Query();
- const assets = await Query.only("title").toJSON().find();
+ const assets = await Query.only('title').toJSON().find();
expect(assets[0].length).toBeTruthy();
@@ -532,18 +532,18 @@ describe("Contentstack Asset Tests", () => {
return (
asset &&
Object.keys(asset).length === 5 &&
- "title" in asset &&
- "uid" in asset &&
- "url" in asset
+ 'title' in asset &&
+ 'uid' in asset &&
+ 'url' in asset
);
});
expect(flag).toBeTruthy();
});
- test(".only() - Multiple String Parameter", async () => {
+ test('.only() - Multiple String Parameter', async () => {
const Query = Stack.Assets().Query();
- const assets = await Query.only("BASE", "title").toJSON().find();
+ const assets = await Query.only('BASE', 'title').toJSON().find();
expect(assets[0].length).toBeTruthy();
@@ -551,18 +551,18 @@ describe("Contentstack Asset Tests", () => {
return (
asset &&
Object.keys(asset).length === 5 &&
- "title" in asset &&
- "uid" in asset &&
- "url" in asset
+ 'title' in asset &&
+ 'uid' in asset &&
+ 'url' in asset
);
});
expect(flag).toBeTruthy();
});
- test(".only() - Array Parameter", async () => {
+ test('.only() - Array Parameter', async () => {
const Query = Stack.Assets().Query();
- const assets = await Query.only(["title", "filename"]).toJSON().find();
+ const assets = await Query.only(['title', 'filename']).toJSON().find();
expect(assets[0].length).toBeTruthy();
@@ -570,10 +570,10 @@ describe("Contentstack Asset Tests", () => {
return (
asset &&
Object.keys(asset).length === 5 &&
- "title" in asset &&
- "filename" in asset &&
- "uid" in asset &&
- "url" in asset
+ 'title' in asset &&
+ 'filename' in asset &&
+ 'uid' in asset &&
+ 'url' in asset
);
});
expect(flag).toBeTruthy();
diff --git a/test/asset/image-transformation.js b/test/asset/image-transformation.js
index 87ac2861..6859090f 100755
--- a/test/asset/image-transformation.js
+++ b/test/asset/image-transformation.js
@@ -26,8 +26,8 @@ describe('Image Transformation Tests', () => {
const assets = await Stack.Assets().Query().toJSON().find();
Asset = assets[0][0];
} catch (error) {
- console.error("error:", error);
- throw new Error("Failed to get assets");
+ console.error('error:', error);
+ throw new Error('Failed to get assets');
}
});
@@ -41,9 +41,9 @@ describe('Image Transformation Tests', () => {
const Params = {
quality: 50
};
-
+
beforeAll(() => {
- const URL = Asset['url'];
+ const URL = Asset.url;
Image = Stack.imageTransform(URL, Params);
});
@@ -67,9 +67,9 @@ describe('Image Transformation Tests', () => {
auto: 'webp',
format: 'jpg'
};
-
+
beforeAll(() => {
- const URL = Asset['url'];
+ const URL = Asset.url;
Image = Stack.imageTransform(URL, Params);
});
@@ -99,9 +99,9 @@ describe('Image Transformation Tests', () => {
const Params = {
quality: 50
};
-
+
beforeAll(() => {
- const URL = Asset['url'] + '?';
+ const URL = Asset.url + '?';
Image = Stack.imageTransform(URL, Params);
});
@@ -125,9 +125,9 @@ describe('Image Transformation Tests', () => {
auto: 'webp',
format: 'jpg'
};
-
+
beforeAll(() => {
- const URL = Asset['url'] + '?';
+ const URL = Asset.url + '?';
Image = Stack.imageTransform(URL, Params);
});
@@ -151,4 +151,4 @@ describe('Image Transformation Tests', () => {
expect(Image.match(Regexp).length).toBe(1);
});
});
-});
\ No newline at end of file
+});
diff --git a/test/asset/spread.js b/test/asset/spread.js
index 6fe9b0d1..bb377310 100755
--- a/test/asset/spread.js
+++ b/test/asset/spread.js
@@ -1,16 +1,16 @@
/**
* Created by Aamod Pisat on 09-06-2017.
*/
-"use strict";
+'use strict';
/*
* Module Dependencies.
*/
-const Contentstack = require("../../dist/node/contentstack.js");
-const init = require("../config.js");
+const Contentstack = require('../../dist/node/contentstack.js');
+const init = require('../config.js');
let Stack;
-describe("Contentstack Asset Tests", () => {
+describe('Contentstack Asset Tests', () => {
// Initialize the Contentstack Stack Instance
beforeAll(() => {
return new Promise((resolve) => {
@@ -20,9 +20,9 @@ describe("Contentstack Asset Tests", () => {
});
});
- test("assets as first argument", async () => {
+ test('assets as first argument', async () => {
const Query = Stack.Assets().Query();
- const field = "updated_at";
+ const field = 'updated_at';
const result = await Query.limit(1).toJSON().find();
@@ -40,9 +40,9 @@ describe("Contentstack Asset Tests", () => {
}
});
- test("with assets and count argument", async () => {
+ test('with assets and count argument', async () => {
const Query = Stack.Assets().Query();
- const field = "updated_at";
+ const field = 'updated_at';
const result = await Query.includeCount().toJSON().find();
diff --git a/test/config.js b/test/config.js
index 0cea9c0c..ecb3511e 100755
--- a/test/config.js
+++ b/test/config.js
@@ -5,17 +5,17 @@ const requiredVars = ['HOST', 'API_KEY', 'DELIVERY_TOKEN', 'ENVIRONMENT'];
const missingVars = requiredVars.filter((key) => !process.env[key]);
if (missingVars.length > 0) {
- const errorMessage = `\x1b[31mError: Missing environment variables - ${missingVars.join(', ')}`;
- const error = new Error(errorMessage);
- error.stack = error.message;
- throw error;
+ const errorMessage = `\x1b[31mError: Missing environment variables - ${missingVars.join(', ')}`;
+ const error = new Error(errorMessage);
+ error.stack = error.message;
+ throw error;
}
module.exports = {
- stack: { 'api_key': process.env.API_KEY, 'delivery_token': process.env.DELIVERY_TOKEN, 'environment': process.env.ENVIRONMENT, },
- host: process.env.HOST,
- contentTypes: {
- source: "source",
- numbers_content_type: "numbers_content_type"
- },
-}
\ No newline at end of file
+ stack: { api_key: process.env.API_KEY, delivery_token: process.env.DELIVERY_TOKEN, environment: process.env.ENVIRONMENT },
+ host: process.env.HOST,
+ contentTypes: {
+ source: 'source',
+ numbers_content_type: 'numbers_content_type'
+ }
+};
diff --git a/test/entry/find-result-wrapper.js b/test/entry/find-result-wrapper.js
index a62e73a1..db2c9343 100755
--- a/test/entry/find-result-wrapper.js
+++ b/test/entry/find-result-wrapper.js
@@ -1,16 +1,16 @@
-"use strict";
+'use strict';
/*
* Module Dependencies.
*/
-const Contentstack = require("../../dist/node/contentstack.js");
-const init = require("../config.js");
-const Utils = require("./utils.js");
+const Contentstack = require('../../dist/node/contentstack.js');
+const init = require('../config.js');
+const Utils = require('./utils.js');
const contentTypes = init.contentTypes;
let Stack;
-let error = null;
+const error = null;
-describe("ContentStack SDK Tests", () => {
+describe('ContentStack SDK Tests', () => {
// Initialize the Contentstack Stack Instance
beforeAll(() => {
return new Promise((resolve) => {
@@ -20,9 +20,9 @@ describe("ContentStack SDK Tests", () => {
});
});
- describe("default .find()", () => {
+ describe('default .find()', () => {
let entries;
- const field = "updated_at";
+ const field = 'updated_at';
// Setup - run the query once for all tests
beforeAll(async () => {
@@ -30,18 +30,18 @@ describe("ContentStack SDK Tests", () => {
entries = await Query.toJSON().find();
});
- test("should return a non-empty array of entries", async () => {
+ test('should return a non-empty array of entries', async () => {
expect(entries).toBeDefined();
expect(Array.isArray(entries)).toBe(true);
expect(entries[0]).toBeDefined();
expect(entries[0].length).toBeTruthy();
});
- test("should not include count when not requested", async () => {
+ test('should not include count when not requested', async () => {
expect(entries[1]).toBeFalsy();
});
- test("should return entries sorted by updated_at in descending order by default", async () => {
+ test('should return entries sorted by updated_at in descending order by default', async () => {
if (entries && entries.length && entries[0].length) {
let prev = entries[0][0][field];
const _entries = entries[0].every(function (entry) {
@@ -50,26 +50,26 @@ describe("ContentStack SDK Tests", () => {
});
expect(_entries).toBe(true);
} else {
- console.warn("Not enough entries returned to verify default sorting");
+ console.warn('Not enough entries returned to verify default sorting');
}
});
- test("should have entries with valid structure", async () => {
+ test('should have entries with valid structure', async () => {
if (entries && entries.length && entries[0].length) {
const firstEntry = entries[0][0];
- expect(firstEntry).toHaveProperty("uid");
- expect(firstEntry).toHaveProperty("title");
- expect(firstEntry).toHaveProperty("updated_at");
+ expect(firstEntry).toHaveProperty('uid');
+ expect(firstEntry).toHaveProperty('title');
+ expect(firstEntry).toHaveProperty('updated_at');
} else {
- console.warn("No entries returned to verify structure");
+ console.warn('No entries returned to verify structure');
}
});
});
- describe("sorting", () => {
- test(".ascending()", async () => {
+ describe('sorting', () => {
+ test('.ascending()', async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- const field = "updated_at";
+ const field = 'updated_at';
const entries = await Query.ascending(field).toJSON().find();
@@ -85,9 +85,9 @@ describe("ContentStack SDK Tests", () => {
}
});
- test(".descending()", async () => {
+ test('.descending()', async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- const field = "created_at";
+ const field = 'created_at';
const entries = await Query.descending(field).toJSON().find();
@@ -104,15 +104,15 @@ describe("ContentStack SDK Tests", () => {
});
});
- describe("comparison", () => {
- test(".lessThan()", async () => {
+ describe('comparison', () => {
+ test('.lessThan()', async () => {
const Query = Stack.ContentType(
contentTypes.numbers_content_type
).Query();
const value = 11;
- const field = "updated_at";
+ const field = 'updated_at';
- const entries = await Query.lessThan("num_field", value).toJSON().find();
+ const entries = await Query.lessThan('num_field', value).toJSON().find();
expect(entries[0].length).toBeTruthy();
@@ -127,14 +127,14 @@ describe("ContentStack SDK Tests", () => {
}
});
- test(".lessThanOrEqualTo()", async () => {
+ test('.lessThanOrEqualTo()', async () => {
const Query = Stack.ContentType(
contentTypes.numbers_content_type
).Query();
- const field = "updated_at";
+ const field = 'updated_at';
const value = 11;
- const entries = await Query.lessThanOrEqualTo("num_field", value)
+ const entries = await Query.lessThanOrEqualTo('num_field', value)
.toJSON()
.find();
@@ -151,14 +151,14 @@ describe("ContentStack SDK Tests", () => {
}
});
- test(".greaterThan()", async () => {
+ test('.greaterThan()', async () => {
const Query = Stack.ContentType(
contentTypes.numbers_content_type
).Query();
- const field = "num_field";
+ const field = 'num_field';
const value = 11;
- const entries = await Query.greaterThan("num_field", value)
+ const entries = await Query.greaterThan('num_field', value)
.ascending(field)
.toJSON()
.find();
@@ -176,14 +176,14 @@ describe("ContentStack SDK Tests", () => {
}
});
- test(".greaterThanOrEqualTo()", async () => {
+ test('.greaterThanOrEqualTo()', async () => {
const Query = Stack.ContentType(
contentTypes.numbers_content_type
).Query();
- const field = "num_field";
+ const field = 'num_field';
const value = 11;
- const entries = await Query.greaterThanOrEqualTo("num_field", value)
+ const entries = await Query.greaterThanOrEqualTo('num_field', value)
.descending(field)
.toJSON()
.find();
@@ -201,14 +201,14 @@ describe("ContentStack SDK Tests", () => {
}
});
- test(".notEqualTo()", async () => {
+ test('.notEqualTo()', async () => {
const Query = Stack.ContentType(
contentTypes.numbers_content_type
).Query();
- const field = "num_field";
+ const field = 'num_field';
const value = 6;
- const entries = await Query.notEqualTo("num_field", value)
+ const entries = await Query.notEqualTo('num_field', value)
.descending(field)
.toJSON()
.find();
@@ -227,39 +227,39 @@ describe("ContentStack SDK Tests", () => {
});
});
- describe("array/subset", () => {
- test(".containedIn()", async () => {
+ describe('array/subset', () => {
+ test('.containedIn()', async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- const _in = ["source1", "source2"];
- const field = "updated_at";
+ const _in = ['source1', 'source2'];
+ const field = 'updated_at';
- const entries = await Query.containedIn("title", _in).toJSON().find();
+ const entries = await Query.containedIn('title', _in).toJSON().find();
expect(entries[0].length).toBeTruthy();
if (entries && entries.length && entries[0].length) {
const _entries = entries[0].every(function (entry) {
- return _in.indexOf(entry["title"]) != -1;
+ return _in.indexOf(entry.title) != -1;
});
expect(_entries).toBe(true);
}
});
- test(".notContainedIn()", async () => {
+ test('.notContainedIn()', async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- const _in = ["sourceddd1", "sourceddddd2"];
+ const _in = ['sourceddd1', 'sourceddddd2'];
- const entries = await Query.notContainedIn("title", _in).toJSON().find();
+ const entries = await Query.notContainedIn('title', _in).toJSON().find();
expect(entries[0].length).toBeTruthy();
});
});
- describe("exists", () => {
- test(".exists()", async () => {
+ describe('exists', () => {
+ test('.exists()', async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- const queryField = "boolean";
- const field = "updated_at";
+ const queryField = 'boolean';
+ const field = 'updated_at';
const entries = await Query.exists(queryField).toJSON().find();
@@ -276,17 +276,17 @@ describe("ContentStack SDK Tests", () => {
}
});
- test(".notExists()", async () => {
+ test('.notExists()', async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- const queryField = "isspecial";
- const field = "updated_at";
+ const queryField = 'isspecial';
+ const field = 'updated_at';
const entries = await Query.notExists(queryField).toJSON().find();
- expect("entries" in entries).toBeTruthy();
+ expect('entries' in entries).toBeTruthy();
if (entries && entries.length && entries[0].length) {
- let prev = entries[0][0][field];
+ const prev = entries[0][0][field];
const _entries = entries[0].every(function (entry) {
return entry[field] <= prev;
});
@@ -295,10 +295,10 @@ describe("ContentStack SDK Tests", () => {
});
});
- describe("pagination", () => {
- test(".skip()", async () => {
+ describe('pagination', () => {
+ test('.skip()', async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- const field = "updated_at";
+ const field = 'updated_at';
const allEntries = await Query.toJSON().find();
@@ -323,9 +323,9 @@ describe("ContentStack SDK Tests", () => {
}
});
- test(".limit()", async () => {
+ test('.limit()', async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- const field = "updated_at";
+ const field = 'updated_at';
const allEntries = await Query.toJSON().find();
@@ -349,7 +349,7 @@ describe("ContentStack SDK Tests", () => {
}
});
- test(".count()", async () => {
+ test('.count()', async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
const entries = await Query.count().toJSON().find();
@@ -358,164 +358,164 @@ describe("ContentStack SDK Tests", () => {
});
});
- describe("logical", () => {
- describe(".or() - Query Objects", () => {
+ describe('logical', () => {
+ describe('.or() - Query Objects', () => {
let entries;
- const titles = ["source1", "source2"];
+ const titles = ['source1', 'source2'];
beforeAll(async () => {
const Query1 = Stack.ContentType(contentTypes.source)
.Query()
- .containedIn("title", titles);
+ .containedIn('title', titles);
const Query2 = Stack.ContentType(contentTypes.source)
.Query()
- .where("boolean", true);
+ .where('boolean', true);
const Query = Stack.ContentType(contentTypes.source).Query();
entries = await Query.or(Query1, Query2).toJSON().find();
});
- test("should return a non-empty array of entries", async () => {
+ test('should return a non-empty array of entries', async () => {
expect(entries).toBeDefined();
expect(Array.isArray(entries)).toBe(true);
expect(entries[0]).toBeDefined();
expect(entries[0].length).toBeTruthy();
});
- test("should return entries matching at least one of the conditions", async () => {
+ test('should return entries matching at least one of the conditions', async () => {
if (entries && entries.length && entries[0].length) {
const allEntriesMatchAnyCondition = entries[0].every(
(entry) => titles.includes(entry.title) || entry.boolean === true
);
expect(allEntriesMatchAnyCondition).toBe(true);
} else {
- console.warn("No entries returned to verify OR condition");
+ console.warn('No entries returned to verify OR condition');
}
});
- test("should include entries with title in the specified list", async () => {
+ test('should include entries with title in the specified list', async () => {
if (entries && entries.length && entries[0].length) {
const hasEntryWithTitle = entries[0].some((entry) =>
titles.includes(entry.title)
);
expect(hasEntryWithTitle).toBe(true);
} else {
- console.warn("No entries returned to verify first condition");
+ console.warn('No entries returned to verify first condition');
}
});
- test("should include entries with boolean field set to true", async () => {
+ test('should include entries with boolean field set to true', async () => {
if (entries && entries.length && entries[0].length) {
const hasEntryWithBoolean = entries[0].some(
(entry) => entry.boolean === true
);
expect(hasEntryWithBoolean).toBe(true);
} else {
- console.warn("No entries returned to verify second condition");
+ console.warn('No entries returned to verify second condition');
}
});
});
- describe(".and() - Query Objects", () => {
+ describe('.and() - Query Objects', () => {
let entries;
beforeAll(async () => {
const Query1 = Stack.ContentType(contentTypes.source)
.Query()
- .where("title", "source1");
+ .where('title', 'source1');
const Query2 = Stack.ContentType(contentTypes.source)
.Query()
- .where("boolean", true);
+ .where('boolean', true);
const Query = Stack.ContentType(contentTypes.source).Query();
entries = await Query.and(Query1, Query2).toJSON().find();
});
- test("should return a non-empty array of entries", async () => {
+ test('should return a non-empty array of entries', async () => {
expect(entries).toBeDefined();
expect(Array.isArray(entries)).toBe(true);
expect(entries[0]).toBeDefined();
expect(entries[0].length).toBeTruthy();
});
- test("should return only entries matching all specified conditions", async () => {
+ test('should return only entries matching all specified conditions', async () => {
if (entries && entries.length && entries[0].length) {
const allEntriesMatchAllConditions = entries[0].every(
- (entry) => entry.title === "source1" && entry.boolean === true
+ (entry) => entry.title === 'source1' && entry.boolean === true
);
expect(allEntriesMatchAllConditions).toBe(true);
} else {
- console.warn("No entries returned to verify AND condition");
+ console.warn('No entries returned to verify AND condition');
}
});
test('should include entries with title set to "source1"', async () => {
if (entries && entries.length && entries[0].length) {
const allEntriesHaveCorrectTitle = entries[0].every(
- (entry) => entry.title === "source1"
+ (entry) => entry.title === 'source1'
);
expect(allEntriesHaveCorrectTitle).toBe(true);
} else {
- console.warn("No entries returned to verify title condition");
+ console.warn('No entries returned to verify title condition');
}
});
- test("should include entries with boolean field set to true", async () => {
+ test('should include entries with boolean field set to true', async () => {
if (entries && entries.length && entries[0].length) {
const allEntriesHaveBooleanTrue = entries[0].every(
(entry) => entry.boolean === true
);
expect(allEntriesHaveBooleanTrue).toBe(true);
} else {
- console.warn("No entries returned to verify boolean condition");
+ console.warn('No entries returned to verify boolean condition');
}
});
});
- describe(".query() - Raw query", () => {
+ describe('.query() - Raw query', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
entries = await Query.query({
- $or: [{ title: "source1" }, { boolean: true }],
+ $or: [{ title: 'source1' }, { boolean: true }]
})
.toJSON()
.find();
});
- test("should return a non-empty array of entries", async () => {
+ test('should return a non-empty array of entries', async () => {
expect(entries).toBeDefined();
expect(Array.isArray(entries)).toBe(true);
expect(entries[0]).toBeDefined();
expect(entries[0].length).toBeTruthy();
});
- test("should return entries matching at least one of the conditions in the raw query", async () => {
+ test('should return entries matching at least one of the conditions in the raw query', async () => {
if (entries && entries.length && entries[0].length) {
const allEntriesMatchAnyCondition = entries[0].every(
- (entry) => entry.title === "source1" || entry.boolean === true
+ (entry) => entry.title === 'source1' || entry.boolean === true
);
expect(allEntriesMatchAnyCondition).toBe(true);
} else {
- console.warn("No entries returned to verify raw query conditions");
+ console.warn('No entries returned to verify raw query conditions');
}
});
test('should include entries with title "source1"', async () => {
if (entries && entries.length && entries[0].length) {
const hasEntryWithTitle = entries[0].some(
- (entry) => entry.title === "source1"
+ (entry) => entry.title === 'source1'
);
expect(hasEntryWithTitle).toBe(true);
} else {
console.warn(
- "No entries returned to verify first raw query condition"
+ 'No entries returned to verify first raw query condition'
);
}
});
- test("should include entries with boolean field set to true", async () => {
+ test('should include entries with boolean field set to true', async () => {
if (entries && entries.length && entries[0].length) {
const hasEntryWithBoolean = entries[0].some(
(entry) => entry.boolean === true
@@ -523,19 +523,19 @@ describe("ContentStack SDK Tests", () => {
expect(hasEntryWithBoolean).toBe(true);
} else {
console.warn(
- "No entries returned to verify second raw query condition"
+ 'No entries returned to verify second raw query condition'
);
}
});
});
});
- describe("custom query", () => {
- test(".query() - Raw query with basic OR condition", async () => {
+ describe('custom query', () => {
+ test('.query() - Raw query with basic OR condition', async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
const entries = await Query.query({
- $or: [{ title: "source1" }, { boolean: "true" }],
+ $or: [{ title: 'source1' }, { boolean: 'true' }]
})
.toJSON()
.find();
@@ -544,17 +544,17 @@ describe("ContentStack SDK Tests", () => {
if (entries && entries.length && entries[0].length) {
const _entries = entries[0].every(function (entry) {
- return entry.title === "source1" || entry.boolean === true;
+ return entry.title === 'source1' || entry.boolean === true;
});
expect(_entries).toBeTruthy();
}
});
- test(".query() - Raw query with AND condition", async () => {
+ test('.query() - Raw query with AND condition', async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
const entries = await Query.query({
- $and: [{ title: "source1" }, { boolean: true }],
+ $and: [{ title: 'source1' }, { boolean: true }]
})
.toJSON()
.find();
@@ -562,19 +562,19 @@ describe("ContentStack SDK Tests", () => {
expect(entries[0].length).toBeTruthy();
const allMatchBothConditions = entries[0].every(
- (entry) => entry.title === "source1" && entry.boolean === true
+ (entry) => entry.title === 'source1' && entry.boolean === true
);
expect(allMatchBothConditions).toBeTruthy();
});
- test(".query() - Raw query with nested conditions", async () => {
+ test('.query() - Raw query with nested conditions', async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
const entries = await Query.query({
$and: [
- { title: "source1" },
- { $or: [{ boolean: true }, { url: { $exists: true } }] },
- ],
+ { title: 'source1' },
+ { $or: [{ boolean: true }, { url: { $exists: true } }] }
+ ]
})
.toJSON()
.find();
@@ -583,18 +583,18 @@ describe("ContentStack SDK Tests", () => {
const allMatchConditions = entries[0].every(
(entry) =>
- entry.title === "source1" &&
+ entry.title === 'source1' &&
(entry.boolean === true || entry.url !== undefined)
);
expect(allMatchConditions).toBeTruthy();
});
});
- describe("tags", () => {
- test(".tags() - Multiple tags filter", async () => {
+ describe('tags', () => {
+ test('.tags() - Multiple tags filter', async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- const field = "tags";
- const tags = ["tag1", "tag2"];
+ const field = 'tags';
+ const tags = ['tag1', 'tag2'];
const entries = await Query.tags(tags).toJSON().find();
@@ -608,10 +608,10 @@ describe("ContentStack SDK Tests", () => {
}
});
- test(".tags() - Single tag filter", async () => {
+ test('.tags() - Single tag filter', async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- const field = "tags";
- const tags = ["tag1"];
+ const field = 'tags';
+ const tags = ['tag1'];
const entries = await Query.tags(tags).toJSON().find();
@@ -625,9 +625,9 @@ describe("ContentStack SDK Tests", () => {
}
});
- test(".tags() - Empty results with non-existent tag", async () => {
+ test('.tags() - Empty results with non-existent tag', async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- const nonExistentTag = ["non_existent_tag_123456"];
+ const nonExistentTag = ['non_existent_tag_123456'];
const entries = await Query.tags(nonExistentTag).toJSON().find();
@@ -638,59 +638,59 @@ describe("ContentStack SDK Tests", () => {
});
});
- describe("search", () => {
- test(".search() - Exact match", async () => {
+ describe('search', () => {
+ test('.search() - Exact match', async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- const entries = await Query.search("source1").toJSON().find();
+ const entries = await Query.search('source1').toJSON().find();
expect(entries[0].length).toBeTruthy();
const hasMatchingEntries = entries[0].some(
(entry) =>
- entry.title === "source1" || JSON.stringify(entry).includes("source1")
+ entry.title === 'source1' || JSON.stringify(entry).includes('source1')
);
expect(hasMatchingEntries).toBe(true);
});
- test(".search() - Partial match", async () => {
+ test('.search() - Partial match', async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- const entries = await Query.search("source").toJSON().find();
+ const entries = await Query.search('source').toJSON().find();
expect(entries[0].length).toBeTruthy();
const hasMatchingEntries = entries[0].some(
(entry) =>
- (entry.title && entry.title.includes("source")) ||
- JSON.stringify(entry).includes("source")
+ (entry.title && entry.title.includes('source')) ||
+ JSON.stringify(entry).includes('source')
);
expect(hasMatchingEntries).toBe(true);
});
- test(".search() - Case insensitive match", async () => {
+ test('.search() - Case insensitive match', async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- const entries = await Query.search("SOURCE1").toJSON().find();
+ const entries = await Query.search('SOURCE1').toJSON().find();
expect(entries[0].length).toBeTruthy();
const hasMatchingEntries = entries[0].some(
(entry) =>
- (entry.title && entry.title.toLowerCase() === "source1") ||
- JSON.stringify(entry).toLowerCase().includes("source1")
+ (entry.title && entry.title.toLowerCase() === 'source1') ||
+ JSON.stringify(entry).toLowerCase().includes('source1')
);
expect(hasMatchingEntries).toBe(true);
});
});
- describe("regex", () => {
- test(".regex() - Basic pattern match", async () => {
+ describe('regex', () => {
+ test('.regex() - Basic pattern match', async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- const field = "title";
+ const field = 'title';
const regex = {
- pattern: "^source",
- options: "i",
+ pattern: '^source',
+ options: 'i'
};
const regexpObj = new RegExp(regex.pattern, regex.options);
@@ -706,12 +706,12 @@ describe("ContentStack SDK Tests", () => {
expect(flag).toBeTruthy();
});
- test(".regex() - Specific suffix pattern", async () => {
+ test('.regex() - Specific suffix pattern', async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- const field = "title";
+ const field = 'title';
const regex = {
- pattern: "1$", // Matches strings ending with 1
- options: "",
+ pattern: '1$', // Matches strings ending with 1
+ options: ''
};
const regexpObj = new RegExp(regex.pattern, regex.options);
@@ -728,18 +728,18 @@ describe("ContentStack SDK Tests", () => {
expect(matchesPattern).toBeTruthy();
const endsWithOne = entries[0].every(
- (entry) => entry[field] && entry[field].endsWith("1")
+ (entry) => entry[field] && entry[field].endsWith('1')
);
expect(endsWithOne).toBeTruthy();
}
});
- test(".regex() - With wildcard pattern", async () => {
+ test('.regex() - With wildcard pattern', async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- const field = "title";
+ const field = 'title';
const regex = {
- pattern: "source.*",
- options: "i",
+ pattern: 'source.*',
+ options: 'i'
};
const regexpObj = new RegExp(regex.pattern, regex.options);
@@ -758,9 +758,9 @@ describe("ContentStack SDK Tests", () => {
});
});
- describe("locale and fallback", () => {
- test("find: with specific locale", async () => {
- const locale = "ja-jp";
+ describe('locale and fallback', () => {
+ test('find: with specific locale', async () => {
+ const locale = 'ja-jp';
const entries = await Stack.ContentType(contentTypes.source)
.Query()
@@ -779,9 +779,9 @@ describe("ContentStack SDK Tests", () => {
}
});
- test("find: with fallback enabled for partially localized content", async () => {
- const primaryLocale = "ja-jp";
- const fallbackLocale = "en-us";
+ test('find: with fallback enabled for partially localized content', async () => {
+ const primaryLocale = 'ja-jp';
+ const fallbackLocale = 'en-us';
const entries = await Stack.ContentType(contentTypes.source)
.Query()
@@ -814,8 +814,8 @@ describe("ContentStack SDK Tests", () => {
}
});
- test("find: comparing results with and without fallback", async () => {
- const locale = "ja-jp";
+ test('find: comparing results with and without fallback', async () => {
+ const locale = 'ja-jp';
const entriesWithoutFallback = await Stack.ContentType(
contentTypes.source
@@ -845,68 +845,68 @@ describe("ContentStack SDK Tests", () => {
});
});
- describe("include reference", () => {
- describe(".includeReference() - String", () => {
+ describe('include reference', () => {
+ describe('.includeReference() - String', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.includeReference("reference").toJSON().find();
+ entries = await Query.includeReference('reference').toJSON().find();
});
- test("should return entries with the reference field", () => {
+ test('should return entries with the reference field', () => {
expect(entries[0].length).toBeGreaterThan(0);
});
- test("should include the reference field as an object", () => {
+ test('should include the reference field as an object', () => {
const allEntriesHaveReference = entries[0].every(
(entry) =>
entry &&
- entry["reference"] &&
- typeof entry["reference"] === "object"
+ entry.reference &&
+ typeof entry.reference === 'object'
);
expect(allEntriesHaveReference).toBe(true);
});
});
- describe(".includeReference() - Array", () => {
+ describe('.includeReference() - Array', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.includeReference(["reference", "other_reference"])
+ entries = await Query.includeReference(['reference', 'other_reference'])
.toJSON()
.find();
});
- test("should return entries with data", () => {
+ test('should return entries with data', () => {
expect(entries[0].length).toBeGreaterThan(0);
});
- test("should include the first reference field as an object", () => {
+ test('should include the first reference field as an object', () => {
const allEntriesHaveFirstReference = entries[0].every(
(entry) =>
entry &&
- entry["reference"] &&
- typeof entry["reference"] === "object"
+ entry.reference &&
+ typeof entry.reference === 'object'
);
expect(allEntriesHaveFirstReference).toBe(true);
});
- test("should include the second reference field as an object", () => {
+ test('should include the second reference field as an object', () => {
const allEntriesHaveSecondReference = entries[0].every(
(entry) =>
entry &&
- entry["other_reference"] &&
- typeof entry["other_reference"] === "object"
+ entry.other_reference &&
+ typeof entry.other_reference === 'object'
);
expect(allEntriesHaveSecondReference).toBe(true);
});
});
});
- describe("include count and schema", () => {
- describe(".includeCount()", () => {
+ describe('include count and schema', () => {
+ describe('.includeCount()', () => {
let entries;
beforeAll(async () => {
@@ -914,16 +914,16 @@ describe("ContentStack SDK Tests", () => {
entries = await Query.includeCount().toJSON().find();
});
- test("should return entries", () => {
+ test('should return entries', () => {
expect(entries[0].length).toBeTruthy();
});
- test("should include count information", () => {
+ test('should include count information', () => {
expect(entries[1]).toBeTruthy();
});
});
- describe(".includeSchema()", () => {
+ describe('.includeSchema()', () => {
let entries;
beforeAll(async () => {
@@ -931,16 +931,16 @@ describe("ContentStack SDK Tests", () => {
entries = await Query.includeSchema().toJSON().find();
});
- test("should return entries", () => {
+ test('should return entries', () => {
expect(entries[0].length).toBeTruthy();
});
- test("should include schema information", () => {
+ test('should include schema information', () => {
expect(entries[1].length).toBeTruthy();
});
});
- describe(".includeCount() and .includeSchema()", () => {
+ describe('.includeCount() and .includeSchema()', () => {
let entries;
beforeAll(async () => {
@@ -948,22 +948,22 @@ describe("ContentStack SDK Tests", () => {
entries = await Query.includeCount().includeSchema().toJSON().find();
});
- test("should return entries", () => {
+ test('should return entries', () => {
expect(entries[0].length).toBeTruthy();
});
- test("should include schema information", () => {
+ test('should include schema information', () => {
expect(entries[1].length).toBeTruthy();
});
- test("should include count information", () => {
+ test('should include count information', () => {
expect(entries[2]).toBeTruthy();
});
});
});
- describe("include contenttypes", () => {
- describe(".includeContentType()", () => {
+ describe('include contenttypes', () => {
+ describe('.includeContentType()', () => {
let entries;
beforeAll(async () => {
@@ -971,24 +971,24 @@ describe("ContentStack SDK Tests", () => {
entries = await Query.includeContentType().toJSON().find();
});
- test("should return entries", () => {
+ test('should return entries', () => {
expect(entries[0].length).toBeTruthy();
});
- test("should include content type information", () => {
+ test('should include content type information', () => {
expect(entries[1]).toBeTruthy();
});
- test("should include content type title", () => {
- expect(entries[1]["title"]).toBeTruthy();
+ test('should include content type title', () => {
+ expect(entries[1].title).toBeTruthy();
});
- test("should have the correct content type UID", () => {
- expect(entries[1]["uid"]).toBe(contentTypes.source);
+ test('should have the correct content type UID', () => {
+ expect(entries[1].uid).toBe(contentTypes.source);
});
});
- describe(".includeCount() and .includeContentType()", () => {
+ describe('.includeCount() and .includeContentType()', () => {
let entries;
beforeAll(async () => {
@@ -999,28 +999,28 @@ describe("ContentStack SDK Tests", () => {
.find();
});
- test("should return entries", () => {
+ test('should return entries', () => {
expect(entries[0].length).toBeTruthy();
});
- test("should include content type information", () => {
+ test('should include content type information', () => {
expect(entries[1]).toBeTruthy();
});
- test("should include content type title", () => {
- expect(entries[1]["title"]).toBeTruthy();
+ test('should include content type title', () => {
+ expect(entries[1].title).toBeTruthy();
});
- test("should have the correct content type UID", () => {
- expect(entries[1]["uid"]).toBe(contentTypes.source);
+ test('should have the correct content type UID', () => {
+ expect(entries[1].uid).toBe(contentTypes.source);
});
- test("should include count information", () => {
+ test('should include count information', () => {
expect(entries[2]).toBeTruthy();
});
});
- describe(".includeSchema() and .includeContentType()", () => {
+ describe('.includeSchema() and .includeContentType()', () => {
let entries;
beforeAll(async () => {
@@ -1031,24 +1031,24 @@ describe("ContentStack SDK Tests", () => {
.find();
});
- test("should return entries", () => {
+ test('should return entries', () => {
expect(entries[0].length).toBeTruthy();
});
- test("should include content type information", () => {
+ test('should include content type information', () => {
expect(entries[1]).toBeTruthy();
});
- test("should include content type title", () => {
- expect(entries[1]["title"]).toBeTruthy();
+ test('should include content type title', () => {
+ expect(entries[1].title).toBeTruthy();
});
- test("should have the correct content type UID", () => {
- expect(entries[1]["uid"]).toBe(contentTypes.source);
+ test('should have the correct content type UID', () => {
+ expect(entries[1].uid).toBe(contentTypes.source);
});
});
- describe(".includeCount(), .includeSchema() and .includeContentType()", () => {
+ describe('.includeCount(), .includeSchema() and .includeContentType()', () => {
let entries;
beforeAll(async () => {
@@ -1060,196 +1060,196 @@ describe("ContentStack SDK Tests", () => {
.find();
});
- test("should return entries", () => {
+ test('should return entries', () => {
expect(entries[0].length).toBeTruthy();
});
- test("should include content type information", () => {
+ test('should include content type information', () => {
expect(entries[1]).toBeTruthy();
});
- test("should include content type title", () => {
- expect(entries[1]["title"]).toBeTruthy();
+ test('should include content type title', () => {
+ expect(entries[1].title).toBeTruthy();
});
- test("should have the correct content type UID", () => {
- expect(entries[1]["uid"]).toBe(contentTypes.source);
+ test('should have the correct content type UID', () => {
+ expect(entries[1].uid).toBe(contentTypes.source);
});
- test("should include count information", () => {
+ test('should include count information', () => {
expect(entries[2]).toBeTruthy();
});
});
});
- describe("field projections", () => {
- describe(".only() - Single String Parameter", () => {
+ describe('field projections', () => {
+ describe('.only() - Single String Parameter', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.only("title").toJSON().find();
+ entries = await Query.only('title').toJSON().find();
});
- test("should return entries", () => {
+ test('should return entries', () => {
expect(entries[0].length).toBeTruthy();
});
- test("should include only the title and uid fields", () => {
+ test('should include only the title and uid fields', () => {
const correctFieldsOnly = entries[0].every(
(entry) =>
entry &&
Object.keys(entry).length === 2 &&
- "title" in entry &&
- "uid" in entry
+ 'title' in entry &&
+ 'uid' in entry
);
expect(correctFieldsOnly).toBeTruthy();
});
});
- describe(".only() - Multiple String Parameter", () => {
+ describe('.only() - Multiple String Parameter', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.only("BASE", "title").toJSON().find();
+ entries = await Query.only('BASE', 'title').toJSON().find();
});
- test("should return entries", () => {
+ test('should return entries', () => {
expect(entries[0].length).toBeTruthy();
});
- test("should include only the title and uid fields", () => {
+ test('should include only the title and uid fields', () => {
const correctFieldsOnly = entries[0].every(
(entry) =>
entry &&
Object.keys(entry).length === 2 &&
- "title" in entry &&
- "uid" in entry
+ 'title' in entry &&
+ 'uid' in entry
);
expect(correctFieldsOnly).toBeTruthy();
});
});
- describe(".only() - Array Parameter", () => {
+ describe('.only() - Array Parameter', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.only(["title", "url"]).toJSON().find();
+ entries = await Query.only(['title', 'url']).toJSON().find();
});
- test("should return entries", () => {
+ test('should return entries', () => {
expect(entries[0].length).toBeTruthy();
});
- test("should include only the title, url, and uid fields", () => {
+ test('should include only the title, url, and uid fields', () => {
const correctFieldsOnly = entries[0].every(
(entry) =>
entry &&
Object.keys(entry).length === 3 &&
- "title" in entry &&
- "url" in entry &&
- "uid" in entry
+ 'title' in entry &&
+ 'url' in entry &&
+ 'uid' in entry
);
expect(correctFieldsOnly).toBeTruthy();
});
});
- describe(".except() - Single String Parameter", () => {
+ describe('.except() - Single String Parameter', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.except("title").toJSON().find();
+ entries = await Query.except('title').toJSON().find();
});
- test("should return entries", () => {
+ test('should return entries', () => {
expect(entries[0].length).toBeTruthy();
});
- test("should exclude the title field", () => {
+ test('should exclude the title field', () => {
const titleExcluded = entries[0].every(
- (entry) => entry && !("title" in entry)
+ (entry) => entry && !('title' in entry)
);
expect(titleExcluded).toBeTruthy();
});
});
- describe(".except() - Multiple String Parameter", () => {
+ describe('.except() - Multiple String Parameter', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.except("BASE", "title").toJSON().find();
+ entries = await Query.except('BASE', 'title').toJSON().find();
});
- test("should return entries", () => {
+ test('should return entries', () => {
expect(entries[0].length).toBeTruthy();
});
- test("should exclude the title field", () => {
+ test('should exclude the title field', () => {
const titleExcluded = entries[0].every(
- (entry) => entry && !("title" in entry)
+ (entry) => entry && !('title' in entry)
);
expect(titleExcluded).toBeTruthy();
});
});
- describe(".except() - Array of String Parameter", () => {
+ describe('.except() - Array of String Parameter', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.except(["title", "file"]).toJSON().find();
+ entries = await Query.except(['title', 'file']).toJSON().find();
});
- test("should return entries", () => {
+ test('should return entries', () => {
expect(entries[0].length).toBeTruthy();
});
- test("should exclude the title field", () => {
+ test('should exclude the title field', () => {
const titleExcluded = entries[0].every(
- (entry) => entry && !("title" in entry)
+ (entry) => entry && !('title' in entry)
);
expect(titleExcluded).toBeTruthy();
});
- test("should exclude the file field", () => {
+ test('should exclude the file field', () => {
const fileExcluded = entries[0].every(
- (entry) => entry && !("file" in entry)
+ (entry) => entry && !('file' in entry)
);
expect(fileExcluded).toBeTruthy();
});
});
- describe(".except() - For the reference - String", () => {
+ describe('.except() - For the reference - String', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.includeReference("reference")
- .only("BASE", ["reference"])
- .except("reference", "title")
+ entries = await Query.includeReference('reference')
+ .only('BASE', ['reference'])
+ .except('reference', 'title')
.toJSON()
.find();
});
- test("should return entries", () => {
+ test('should return entries', () => {
expect(entries[0].length).toBeTruthy();
});
- test("should properly format entries with reference but without title in references", () => {
+ test('should properly format entries with reference but without title in references', () => {
const correctFormat = entries[0].every((entry) => {
let hasCorrectReferenceFormat = false;
if (
entry &&
- entry["reference"] &&
- typeof entry["reference"] === "object"
+ entry.reference &&
+ typeof entry.reference === 'object'
) {
hasCorrectReferenceFormat = true;
hasCorrectReferenceFormat = entry.reference.every((reference) => {
- return reference && !("title" in reference);
+ return reference && !('title' in reference);
});
}
@@ -1257,8 +1257,8 @@ describe("ContentStack SDK Tests", () => {
hasCorrectReferenceFormat &&
entry &&
Object.keys(entry).length === 2 &&
- "reference" in entry &&
- "uid" in entry
+ 'reference' in entry &&
+ 'uid' in entry
);
});
diff --git a/test/entry/find.js b/test/entry/find.js
index 07276a30..5f15937b 100755
--- a/test/entry/find.js
+++ b/test/entry/find.js
@@ -1,15 +1,15 @@
-"use strict";
+'use strict';
/*
* Module Dependencies.
*/
-const Contentstack = require("../../dist/node/contentstack.js");
-const init = require("../config.js");
-const Utils = require("./utils.js");
+const Contentstack = require('../../dist/node/contentstack.js');
+const init = require('../config.js');
+const Utils = require('./utils.js');
const contentTypes = init.contentTypes;
let Stack;
-describe("ContentStack SDK Tests", () => {
+describe('ContentStack SDK Tests', () => {
// Setup - Initialize the Contentstack Stack Instance
beforeAll((done) => {
Stack = Contentstack.Stack(init.stack);
@@ -17,34 +17,34 @@ describe("ContentStack SDK Tests", () => {
setTimeout(done, 1000);
});
- describe("Stack Initialization", () => {
- test("early_access in stack initialization should add headers", () => {
+ describe('Stack Initialization', () => {
+ test('early_access in stack initialization should add headers', () => {
const stack = Contentstack.Stack({
...init.stack,
- early_access: ["newCDA", "taxonomy"],
+ early_access: ['newCDA', 'taxonomy']
});
- expect(stack.headers["x-header-ea"]).toBe("newCDA,taxonomy");
+ expect(stack.headers['x-header-ea']).toBe('newCDA,taxonomy');
});
});
- describe("Default Find", () => {
+ describe('Default Find', () => {
let entries;
- const field = "updated_at";
+ const field = 'updated_at';
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
entries = await Query.toJSON().find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("Count should not be present", () => {
+ test('Count should not be present', () => {
expect(entries[1]).toBeFalsy();
});
- test("Entries should be sorted by default in descending order of updated_at", () => {
+ test('Entries should be sorted by default in descending order of updated_at', () => {
if (entries && entries.length && entries[0].length > 1) {
let prev = entries[0][0][field];
const sortedCorrectly = entries[0].slice(1).every((entry) => {
@@ -57,21 +57,21 @@ describe("ContentStack SDK Tests", () => {
});
});
- describe("Sorting", () => {
- describe(".ascending()", () => {
+ describe('Sorting', () => {
+ describe('.ascending()', () => {
let entries;
- const field = "updated_at";
+ const field = 'updated_at';
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
entries = await Query.ascending(field).toJSON().find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("Entries should be sorted in ascending order", () => {
+ test('Entries should be sorted in ascending order', () => {
if (entries && entries.length && entries[0].length > 1) {
let prev = entries[0][0][field];
const sortedCorrectly = entries[0].slice(1).every((entry) => {
@@ -84,20 +84,20 @@ describe("ContentStack SDK Tests", () => {
});
});
- describe(".descending()", () => {
+ describe('.descending()', () => {
let entries;
- const field = "created_at";
+ const field = 'created_at';
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
entries = await Query.descending(field).toJSON().find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("Entries should be sorted in descending order", () => {
+ test('Entries should be sorted in descending order', () => {
if (entries && entries.length && entries[0].length > 1) {
let prev = entries[0][0][field];
const sortedCorrectly = entries[0].slice(1).every((entry) => {
@@ -111,43 +111,43 @@ describe("ContentStack SDK Tests", () => {
});
});
- describe("Parameters", () => {
- describe(".addParam()", () => {
+ describe('Parameters', () => {
+ describe('.addParam()', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.addParam("include_count", "true").toJSON().find();
+ entries = await Query.addParam('include_count', 'true').toJSON().find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("Count should be present", () => {
+ test('Count should be present', () => {
expect(entries[1]).toBeTruthy();
});
});
});
- describe("Comparison", () => {
- describe(".lessThan()", () => {
+ describe('Comparison', () => {
+ describe('.lessThan()', () => {
let entries;
- const field = "num_field";
+ const field = 'num_field';
const value = 11;
- test("Should return entry in the resultset", async () => {
+ test('Should return entry in the resultset', async () => {
const Query = Stack.ContentType(
contentTypes.numbers_content_type
).Query();
- const result = await Query.lessThan("num_field", value).toJSON().find();
+ const result = await Query.lessThan('num_field', value).toJSON().find();
entries = result;
expect(entries[0].length).toBeTruthy();
});
- test("All entries should have num_field less than specified value", () => {
+ test('All entries should have num_field less than specified value', () => {
if (entries && entries.length && entries[0].length) {
const allLessThan = entries[0].every((entry) => entry[field] < value);
expect(allLessThan).toBe(true);
@@ -155,33 +155,33 @@ describe("ContentStack SDK Tests", () => {
});
});
- describe(".lessThanOrEqualTo()", () => {
+ describe('.lessThanOrEqualTo()', () => {
let entries;
- const field = "num_field";
+ const field = 'num_field';
const value = 11;
beforeAll(async () => {
const Query = Stack.ContentType(
contentTypes.numbers_content_type
).Query();
- entries = await Query.lessThanOrEqualTo("num_field", value)
+ entries = await Query.lessThanOrEqualTo('num_field', value)
.toJSON()
.find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("All entries should have num_field less than or equal to specified value", () => {
+ test('All entries should have num_field less than or equal to specified value', () => {
const allLessThanOrEqual = entries[0].every(
(entry) => entry[field] <= value
);
expect(allLessThanOrEqual).toBe(true);
});
- test("Entries should be sorted in descending order by default", () => {
- const updatedAtField = "updated_at";
+ test('Entries should be sorted in descending order by default', () => {
+ const updatedAtField = 'updated_at';
if (entries && entries.length && entries[0].length > 1) {
let prev = entries[0][0][updatedAtField];
const sortedCorrectly = entries[0].slice(1).every((entry) => {
@@ -194,33 +194,33 @@ describe("ContentStack SDK Tests", () => {
});
});
- describe(".greaterThan()", () => {
+ describe('.greaterThan()', () => {
let entries;
- const field = "num_field";
+ const field = 'num_field';
const value = 11;
beforeAll(async () => {
const Query = Stack.ContentType(
contentTypes.numbers_content_type
).Query();
- entries = await Query.greaterThan("num_field", value)
+ entries = await Query.greaterThan('num_field', value)
.ascending(field)
.toJSON()
.find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("All entries should have num_field greater than specified value", () => {
+ test('All entries should have num_field greater than specified value', () => {
const allGreaterThan = entries[0].every(
(entry) => entry[field] > value
);
expect(allGreaterThan).toBe(true);
});
- test("Entries should be sorted in ascending order", () => {
+ test('Entries should be sorted in ascending order', () => {
if (entries && entries.length && entries[0].length > 1) {
let prev = entries[0][0][field];
const sortedCorrectly = entries[0].slice(1).every((entry) => {
@@ -233,33 +233,33 @@ describe("ContentStack SDK Tests", () => {
});
});
- describe(".greaterThanOrEqualTo()", () => {
+ describe('.greaterThanOrEqualTo()', () => {
let entries;
- const field = "num_field";
+ const field = 'num_field';
const value = 11;
beforeAll(async () => {
const Query = Stack.ContentType(
contentTypes.numbers_content_type
).Query();
- entries = await Query.greaterThanOrEqualTo("num_field", value)
+ entries = await Query.greaterThanOrEqualTo('num_field', value)
.descending(field)
.toJSON()
.find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("All entries should have num_field greater than or equal to specified value", () => {
+ test('All entries should have num_field greater than or equal to specified value', () => {
const allGreaterThanOrEqual = entries[0].every(
(entry) => entry[field] >= value
);
expect(allGreaterThanOrEqual).toBe(true);
});
- test("Entries should be sorted in descending order", () => {
+ test('Entries should be sorted in descending order', () => {
if (entries && entries.length && entries[0].length > 1) {
let prev = entries[0][0][field];
const sortedCorrectly = entries[0].slice(1).every((entry) => {
@@ -272,31 +272,31 @@ describe("ContentStack SDK Tests", () => {
});
});
- describe(".notEqualTo()", () => {
+ describe('.notEqualTo()', () => {
let entries;
- const field = "num_field";
+ const field = 'num_field';
const value = 6;
beforeAll(async () => {
const Query = Stack.ContentType(
contentTypes.numbers_content_type
).Query();
- entries = await Query.notEqualTo("num_field", value)
+ entries = await Query.notEqualTo('num_field', value)
.descending(field)
.toJSON()
.find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("All entries should have num_field not equal to specified value", () => {
+ test('All entries should have num_field not equal to specified value', () => {
const allNotEqual = entries[0].every((entry) => entry[field] !== value);
expect(allNotEqual).toBe(true);
});
- test("Entries should be sorted in descending order", () => {
+ test('Entries should be sorted in descending order', () => {
if (entries && entries.length && entries[0].length > 1) {
let prev = entries[0][0][field];
const sortedCorrectly = entries[0].slice(1).every((entry) => {
@@ -309,77 +309,77 @@ describe("ContentStack SDK Tests", () => {
});
});
- describe(".where() with boolean value (true)", () => {
+ describe('.where() with boolean value (true)', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.where("boolean", true).toJSON().find();
+ entries = await Query.where('boolean', true).toJSON().find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("Should return four entries in the resultset", () => {
+ test('Should return four entries in the resultset', () => {
expect(entries[0].length).toBe(4);
});
- test("All entries should have boolean field set to true", () => {
+ test('All entries should have boolean field set to true', () => {
const allTrue = entries[0].every((entry) => entry.boolean === true);
expect(allTrue).toBe(true);
});
});
- describe(".where() with boolean value (false)", () => {
+ describe('.where() with boolean value (false)', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.where("boolean", false).toJSON().find();
+ entries = await Query.where('boolean', false).toJSON().find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("Should return three entries in the resultset", () => {
+ test('Should return three entries in the resultset', () => {
expect(entries[0].length).toBe(3);
});
- test("All entries should have boolean field set to false", () => {
+ test('All entries should have boolean field set to false', () => {
const allFalse = entries[0].every((entry) => entry.boolean === false);
expect(allFalse).toBe(true);
});
});
- describe(".where() with empty string", () => {
+ describe('.where() with empty string', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.where("title", "").toJSON().find();
+ entries = await Query.where('title', '').toJSON().find();
});
- test("Should return zero entries in the resultset", () => {
+ test('Should return zero entries in the resultset', () => {
expect(entries[0].length).toBe(0);
});
});
- describe(".tags()", () => {
+ describe('.tags()', () => {
let entries;
- const field = "tags";
- const tags = ["tag1", "tag2"];
+ const field = 'tags';
+ const tags = ['tag1', 'tag2'];
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
entries = await Query.tags(tags).toJSON().find();
});
- test("Should return one or more entries in the resultset", () => {
+ test('Should return one or more entries in the resultset', () => {
expect(entries.length).toBeGreaterThanOrEqual(1);
});
- test("All entries should have at least one of the specified tags", () => {
+ test('All entries should have at least one of the specified tags', () => {
if (entries && entries.length && entries[0].length) {
const allHaveTags = entries[0].every((entry) =>
Utils.arrayPresentInArray(tags, entry[field])
@@ -387,32 +387,32 @@ describe("ContentStack SDK Tests", () => {
expect(allHaveTags).toBe(true);
} else {
// Skip this test if no entries were found
- console.log("No entries found to check tags");
+ console.log('No entries found to check tags');
}
});
});
});
- describe("Array/Subset Tests", () => {
- describe(".containedIn()", () => {
+ describe('Array/Subset Tests', () => {
+ describe('.containedIn()', () => {
let entries;
- const _in = ["source1", "source2"];
- const field = "title";
+ const _in = ['source1', 'source2'];
+ const field = 'title';
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.containedIn("title", _in).toJSON().find();
+ entries = await Query.containedIn('title', _in).toJSON().find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("Should return two entries in the resultset", () => {
+ test('Should return two entries in the resultset', () => {
expect(entries[0].length).toBe(2);
});
- test("All entries should have title field contained in the specified values", () => {
+ test('All entries should have title field contained in the specified values', () => {
if (entries && entries.length && entries[0].length) {
const allContained = entries[0].every((entry) =>
_in.includes(entry[field])
@@ -422,25 +422,25 @@ describe("ContentStack SDK Tests", () => {
});
});
- describe(".notContainedIn()", () => {
+ describe('.notContainedIn()', () => {
let entries;
- const _in = ["source1", "source2"];
- const field = "title";
+ const _in = ['source1', 'source2'];
+ const field = 'title';
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.notContainedIn("title", _in).toJSON().find();
+ entries = await Query.notContainedIn('title', _in).toJSON().find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("Should return three entries in the resultset", () => {
+ test('Should return three entries in the resultset', () => {
expect(entries[0].length).toBe(5);
});
- test("All entries should have title field not contained in the specified values", () => {
+ test('All entries should have title field not contained in the specified values', () => {
if (entries && entries.length && entries[0].length) {
const allNotContained = entries[0].every(
(entry) => !_in.includes(entry[field])
@@ -449,10 +449,10 @@ describe("ContentStack SDK Tests", () => {
}
});
});
- test(".exists() should return entries with the specified field", async () => {
+ test('.exists() should return entries with the specified field', async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- const queryField = "boolean";
- const field = "updated_at";
+ const queryField = 'boolean';
+ const field = 'updated_at';
const entries = await Query.exists(queryField).toJSON().find();
// Check if entries are returned
@@ -470,18 +470,18 @@ describe("ContentStack SDK Tests", () => {
}
});
- test(".notExists() should return entries without the specified field", async () => {
+ test('.notExists() should return entries without the specified field', async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- const queryField = "isspecial";
- const field = "updated_at";
+ const queryField = 'isspecial';
+ const field = 'updated_at';
const entries = await Query.notExists(queryField).toJSON().find();
// Check if entries are returned
- expect("entries" in entries).toBeTruthy();
+ expect('entries' in entries).toBeTruthy();
// Verify sorting order if entries exist
if (entries && entries.length && entries[0].length) {
- let prev = entries[0][0][field];
+ const prev = entries[0][0][field];
const _entries = entries[0].every(function (entry) {
return entry[field] <= prev;
});
@@ -490,11 +490,11 @@ describe("ContentStack SDK Tests", () => {
});
});
- describe("Pagination Tests", () => {
- describe(".skip()", () => {
+ describe('Pagination Tests', () => {
+ describe('.skip()', () => {
let allEntries;
let skippedEntries;
- const field = "updated_at";
+ const field = 'updated_at';
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
@@ -504,19 +504,19 @@ describe("ContentStack SDK Tests", () => {
skippedEntries = await SkipQuery.skip(1).toJSON().find();
});
- test("All entries should be present in the resultset", () => {
+ test('All entries should be present in the resultset', () => {
expect(allEntries[0].length).toBeTruthy();
});
- test("Skipped entries should be present in the resultset", () => {
+ test('Skipped entries should be present in the resultset', () => {
expect(skippedEntries[0].length).toBeGreaterThanOrEqual(2);
});
- test("Skipped entries should match all entries with first skipped", () => {
+ test('Skipped entries should match all entries with first skipped', () => {
expect(skippedEntries[0]).toEqual(allEntries[0].slice(1));
});
- test("Skipped entries should maintain sorting order", () => {
+ test('Skipped entries should maintain sorting order', () => {
if (
skippedEntries &&
skippedEntries.length &&
@@ -533,10 +533,10 @@ describe("ContentStack SDK Tests", () => {
});
});
- describe(".limit()", () => {
+ describe('.limit()', () => {
let allEntries;
let limitedEntries;
- const field = "updated_at";
+ const field = 'updated_at';
const limitNumber = 2;
beforeAll(async () => {
@@ -547,19 +547,19 @@ describe("ContentStack SDK Tests", () => {
limitedEntries = await LimitQuery.limit(limitNumber).toJSON().find();
});
- test("All entries should be present in the resultset", () => {
+ test('All entries should be present in the resultset', () => {
expect(allEntries[0].length).toBeTruthy();
});
- test("Limited entries should be present in the resultset", () => {
+ test('Limited entries should be present in the resultset', () => {
expect(limitedEntries[0].length).toBeTruthy();
});
- test("Limited entries should match first N entries from all entries", () => {
+ test('Limited entries should match first N entries from all entries', () => {
expect(limitedEntries[0]).toEqual(allEntries[0].slice(0, limitNumber));
});
- test("Limited entries should maintain sorting order", () => {
+ test('Limited entries should maintain sorting order', () => {
if (
limitedEntries &&
limitedEntries.length &&
@@ -576,7 +576,7 @@ describe("ContentStack SDK Tests", () => {
});
});
- describe(".count()", () => {
+ describe('.count()', () => {
let count;
beforeAll(async () => {
@@ -584,122 +584,122 @@ describe("ContentStack SDK Tests", () => {
count = await Query.count().toJSON().find();
});
- test("Entries present in the resultset", () => {
+ test('Entries present in the resultset', () => {
expect(count).toBeTruthy();
});
});
});
- describe("Logical Operations", () => {
- describe(".or() - Query Objects", () => {
+ describe('Logical Operations', () => {
+ describe('.or() - Query Objects', () => {
let entries;
beforeAll(async () => {
const Query1 = Stack.ContentType(contentTypes.source)
.Query()
- .where("title", "source2");
+ .where('title', 'source2');
const Query2 = Stack.ContentType(contentTypes.source)
.Query()
- .where("boolean", true);
+ .where('boolean', true);
const Query = Stack.ContentType(contentTypes.source).Query();
entries = await Query.or(Query1, Query2).toJSON().find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("Should return 1 entries in the resultset", () => {
+ test('Should return 1 entries in the resultset', () => {
expect(entries[0].length).toBe(5);
});
- test("All entries should satisfy the OR condition", () => {
+ test('All entries should satisfy the OR condition', () => {
if (entries && entries.length && entries[0].length) {
- let _entries = entries[0].every(function (entry) {
- return ~(entry.title === "source1" || entry.boolean === true);
+ const _entries = entries[0].every(function (entry) {
+ return ~(entry.title === 'source1' || entry.boolean === true);
});
expect(_entries).toBe(true);
}
});
});
- describe(".and() - Query Objects", () => {
+ describe('.and() - Query Objects', () => {
let entries;
beforeAll(async () => {
const Query1 = Stack.ContentType(contentTypes.source)
.Query()
- .where("title", "source1");
+ .where('title', 'source1');
const Query2 = Stack.ContentType(contentTypes.source)
.Query()
- .where("boolean", true);
+ .where('boolean', true);
const Query = Stack.ContentType(contentTypes.source).Query();
entries = await Query.and(Query1, Query2).toJSON().find();
});
- test("Should return one entry in the resultset", () => {
+ test('Should return one entry in the resultset', () => {
expect(entries[0].length).toBe(1);
});
- test("All entries should satisfy the AND condition", () => {
+ test('All entries should satisfy the AND condition', () => {
if (entries && entries.length && entries[0].length) {
const allMatchCondition = entries[0].every(
- (entry) => entry.title === "source1" && entry.boolean === true
+ (entry) => entry.title === 'source1' && entry.boolean === true
);
expect(allMatchCondition).toBe(true);
}
});
});
- describe(".query() - Raw query", () => {
+ describe('.query() - Raw query', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
entries = await Query.query({
- $or: [{ title: "source2" }, { boolean: "true" }],
+ $or: [{ title: 'source2' }, { boolean: 'true' }]
})
.toJSON()
.find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("Should return two entries in the resultset", () => {
+ test('Should return two entries in the resultset', () => {
expect(entries[0].length).toBe(1);
});
- test("All entries should satisfy the OR condition", () => {
+ test('All entries should satisfy the OR condition', () => {
if (entries && entries.length && entries[0].length) {
const allMatchCondition = entries[0].every(
- (entry) => entry.title === "source2" || entry.boolean === false
+ (entry) => entry.title === 'source2' || entry.boolean === false
);
expect(allMatchCondition).toBe(true);
}
});
});
- describe("Search Tests", () => {
- describe(".search()", () => {
+ describe('Search Tests', () => {
+ describe('.search()', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.toJSON().search("source2").find();
+ entries = await Query.toJSON().search('source2').find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
});
});
- describe("Including Additional Data Tests", () => {
- describe(".includeCount() and .includeContentType()", () => {
+ describe('Including Additional Data Tests', () => {
+ describe('.includeCount() and .includeContentType()', () => {
let entries;
beforeAll(async () => {
@@ -710,28 +710,28 @@ describe("ContentStack SDK Tests", () => {
.find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("ContentType should be present in the resultset", () => {
+ test('ContentType should be present in the resultset', () => {
expect(entries[1]).toBeTruthy();
});
- test("ContentType title should exist", () => {
+ test('ContentType title should exist', () => {
expect(entries[1].title).toBeDefined();
});
- test("ContentType uid should match requested content type", () => {
+ test('ContentType uid should match requested content type', () => {
expect(entries[1].uid).toBe(contentTypes.source);
});
- test("Count should be present in the resultset", () => {
+ test('Count should be present in the resultset', () => {
expect(entries[2]).toBeTruthy();
});
});
- describe(".includeEmbeddedItems()", () => {
+ describe('.includeEmbeddedItems()', () => {
let entries;
beforeAll(async () => {
@@ -739,12 +739,12 @@ describe("ContentStack SDK Tests", () => {
entries = await Query.includeEmbeddedItems().toJSON().find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
});
- describe(".includeSchema() and .includeContentType()", () => {
+ describe('.includeSchema() and .includeContentType()', () => {
let entries;
beforeAll(async () => {
@@ -755,24 +755,24 @@ describe("ContentStack SDK Tests", () => {
.find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("ContentType should be present in the resultset", () => {
+ test('ContentType should be present in the resultset', () => {
expect(entries[1]).toBeTruthy();
});
- test("ContentType title should exist", () => {
+ test('ContentType title should exist', () => {
expect(entries[1].title).toBeDefined();
});
- test("ContentType uid should match requested content type", () => {
+ test('ContentType uid should match requested content type', () => {
expect(entries[1].uid).toBe(contentTypes.source);
});
});
- describe(".includeCount(), .includeSchema() and .includeContentType()", () => {
+ describe('.includeCount(), .includeSchema() and .includeContentType()', () => {
let entries;
beforeAll(async () => {
@@ -784,46 +784,46 @@ describe("ContentStack SDK Tests", () => {
.find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("ContentType should be present in the resultset", () => {
+ test('ContentType should be present in the resultset', () => {
expect(entries[1]).toBeTruthy();
});
- test("ContentType title should exist", () => {
+ test('ContentType title should exist', () => {
expect(entries[1].title).toBeDefined();
});
- test("ContentType uid should match requested content type", () => {
+ test('ContentType uid should match requested content type', () => {
expect(entries[1].uid).toBe(contentTypes.source);
});
- test("Count should be present in the resultset", () => {
+ test('Count should be present in the resultset', () => {
expect(entries[2]).toBeTruthy();
});
});
});
- describe("Localization Tests", () => {
- describe("find: without fallback", () => {
+ describe('Localization Tests', () => {
+ describe('find: without fallback', () => {
let entries;
- const _in = ["ja-jp"];
+ const _in = ['ja-jp'];
beforeAll(async () => {
entries = await Stack.ContentType(contentTypes.source)
.Query()
- .language("ja-jp")
+ .language('ja-jp')
.toJSON()
.find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("All entries should have the correct locale", () => {
+ test('All entries should have the correct locale', () => {
if (entries && entries[0].length) {
const allHaveCorrectLocale = entries[0].every((entry) =>
_in.includes(entry.publish_details.locale)
@@ -833,24 +833,24 @@ describe("ContentStack SDK Tests", () => {
});
});
- describe("find: with fallback", () => {
+ describe('find: with fallback', () => {
let entries;
- const _in = ["ja-jp", "en-us"];
+ const _in = ['ja-jp', 'en-us'];
beforeAll(async () => {
entries = await Stack.ContentType(contentTypes.source)
.Query()
- .language("ja-jp")
+ .language('ja-jp')
.includeFallback()
.toJSON()
.find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("All entries should have locale from the allowed fallback list", () => {
+ test('All entries should have locale from the allowed fallback list', () => {
if (entries && entries[0].length) {
const allHaveCorrectLocale = entries[0].every((entry) =>
_in.includes(entry.publish_details.locale)
@@ -861,250 +861,250 @@ describe("ContentStack SDK Tests", () => {
});
});
- describe("Global Field Tests", () => {
- describe(".getContentTypes()", () => {
+ describe('Global Field Tests', () => {
+ describe('.getContentTypes()', () => {
let entries;
beforeAll(async () => {
entries = await Stack.getContentTypes({
- include_global_field_schema: true,
+ include_global_field_schema: true
});
});
- test("Global field schema should be present when applicable", () => {
- for (var i = 0; i < entries.content_types[0].schema.length; i++) {
+ test('Global field schema should be present when applicable', () => {
+ for (let i = 0; i < entries.content_types[0].schema.length; i++) {
if (
- entries.content_types[0].schema[i].data_type === "global_field"
+ entries.content_types[0].schema[i].data_type === 'global_field'
) {
- expect(entries[1]["schema"][i]["schema"]).toBeDefined();
+ expect(entries[1].schema[i].schema).toBeDefined();
}
}
});
});
});
- describe("Field Selection Tests", () => {
- describe(".only() - Single String Parameter", () => {
+ describe('Field Selection Tests', () => {
+ describe('.only() - Single String Parameter', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.only("title").toJSON().find();
+ entries = await Query.only('title').toJSON().find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("All entries should contain only title and uid fields", () => {
+ test('All entries should contain only title and uid fields', () => {
const allHaveCorrectFields = entries[0].every(
(entry) =>
Object.keys(entry).length === 2 &&
- "title" in entry &&
- "uid" in entry
+ 'title' in entry &&
+ 'uid' in entry
);
expect(allHaveCorrectFields).toBe(true);
});
});
- describe(".only() - Multiple String Parameter", () => {
+ describe('.only() - Multiple String Parameter', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.only("BASE", "title").toJSON().find();
+ entries = await Query.only('BASE', 'title').toJSON().find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("All entries should contain only title and uid fields", () => {
+ test('All entries should contain only title and uid fields', () => {
const allHaveCorrectFields = entries[0].every(
(entry) =>
Object.keys(entry).length === 2 &&
- "title" in entry &&
- "uid" in entry
+ 'title' in entry &&
+ 'uid' in entry
);
expect(allHaveCorrectFields).toBe(true);
});
});
- describe(".only() - Array Parameter", () => {
+ describe('.only() - Array Parameter', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.only(["title", "url"]).toJSON().find();
+ entries = await Query.only(['title', 'url']).toJSON().find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("All entries should contain only title, url, and uid fields", () => {
+ test('All entries should contain only title, url, and uid fields', () => {
const allHaveCorrectFields = entries[0].every(
(entry) =>
Object.keys(entry).length === 3 &&
- "title" in entry &&
- "url" in entry &&
- "uid" in entry
+ 'title' in entry &&
+ 'url' in entry &&
+ 'uid' in entry
);
expect(allHaveCorrectFields).toBe(true);
});
});
- describe(".only() - For the reference - String", () => {
+ describe('.only() - For the reference - String', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.includeReference("reference")
- .only("BASE", ["reference"])
- .only("reference", "title")
+ entries = await Query.includeReference('reference')
+ .only('BASE', ['reference'])
+ .only('reference', 'title')
.toJSON()
.find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("All entries should contain reference field", () => {
+ test('All entries should contain reference field', () => {
const allHaveReference = entries[0].every(
- (entry) => "reference" in entry
+ (entry) => 'reference' in entry
);
expect(allHaveReference).toBe(true);
});
});
- describe(".only() - For the reference - Array", () => {
+ describe('.only() - For the reference - Array', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.includeReference("reference")
- .only("BASE", ["reference"])
- .only("reference", ["title"])
+ entries = await Query.includeReference('reference')
+ .only('BASE', ['reference'])
+ .only('reference', ['title'])
.toJSON()
.find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("All entries should contain reference field", () => {
+ test('All entries should contain reference field', () => {
const allHaveReference = entries[0].every(
- (entry) => "reference" in entry
+ (entry) => 'reference' in entry
);
expect(allHaveReference).toBe(true);
});
});
});
- describe("Field Exclusion Tests", () => {
- describe(".except() - Single String Parameter", () => {
+ describe('Field Exclusion Tests', () => {
+ describe('.except() - Single String Parameter', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.except("title").toJSON().find();
+ entries = await Query.except('title').toJSON().find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("All entries should not have title field", () => {
+ test('All entries should not have title field', () => {
const allExcluded = entries[0].every(
- (entry) => entry && !("title" in entry)
+ (entry) => entry && !('title' in entry)
);
expect(allExcluded).toBe(true);
});
});
- describe(".except() - Multiple String Parameter", () => {
+ describe('.except() - Multiple String Parameter', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.except("BASE", "title").toJSON().find();
+ entries = await Query.except('BASE', 'title').toJSON().find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("All entries should not have title field", () => {
+ test('All entries should not have title field', () => {
const allExcluded = entries[0].every(
- (entry) => entry && !("title" in entry)
+ (entry) => entry && !('title' in entry)
);
expect(allExcluded).toBe(true);
});
});
- describe(".except() - Array of String Parameter", () => {
+ describe('.except() - Array of String Parameter', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.except(["title", "file"]).toJSON().find();
+ entries = await Query.except(['title', 'file']).toJSON().find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("All entries should not have title and file fields", () => {
+ test('All entries should not have title and file fields', () => {
const allExcluded = entries[0].every(
- (entry) => entry && !("title" in entry) && !("file" in entry)
+ (entry) => entry && !('title' in entry) && !('file' in entry)
);
expect(allExcluded).toBe(true);
});
});
- describe(".except() - For the reference - String", () => {
+ describe('.except() - For the reference - String', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.includeReference("reference")
- .only("BASE", ["reference"])
- .except("reference", "title")
+ entries = await Query.includeReference('reference')
+ .only('BASE', ['reference'])
+ .except('reference', 'title')
.toJSON()
.find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("All entries should have reference field", () => {
+ test('All entries should have reference field', () => {
const allHaveReference = entries[0].every(
- (entry) => entry && "reference" in entry
+ (entry) => entry && 'reference' in entry
);
expect(allHaveReference).toBe(true);
});
- test("All entries should have uid field", () => {
+ test('All entries should have uid field', () => {
const allHaveUID = entries[0].every(
- (entry) => entry && "uid" in entry
+ (entry) => entry && 'uid' in entry
);
expect(allHaveUID).toBe(true);
});
- test("All references should not have title field", () => {
+ test('All references should not have title field', () => {
let allReferencesExcluded = true;
entries[0].forEach((entry) => {
if (
entry &&
entry.reference &&
- typeof entry.reference === "object"
+ typeof entry.reference === 'object'
) {
entry.reference.forEach((reference) => {
- if (reference && "title" in reference) {
+ if (reference && 'title' in reference) {
allReferencesExcluded = false;
}
});
@@ -1115,47 +1115,47 @@ describe("ContentStack SDK Tests", () => {
});
});
- describe(".except() - For the reference - Array", () => {
+ describe('.except() - For the reference - Array', () => {
let entries;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entries = await Query.includeReference("reference")
- .only("BASE", ["reference"])
- .except("reference", ["title"])
+ entries = await Query.includeReference('reference')
+ .only('BASE', ['reference'])
+ .except('reference', ['title'])
.toJSON()
.find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
- test("All entries should have reference field", () => {
+ test('All entries should have reference field', () => {
const allHaveReference = entries[0].every(
- (entry) => entry && "reference" in entry
+ (entry) => entry && 'reference' in entry
);
expect(allHaveReference).toBe(true);
});
- test("All entries should have uid field", () => {
+ test('All entries should have uid field', () => {
const allHaveUID = entries[0].every(
- (entry) => entry && "uid" in entry
+ (entry) => entry && 'uid' in entry
);
expect(allHaveUID).toBe(true);
});
- test("All references should not have title field", () => {
+ test('All references should not have title field', () => {
let allReferencesExcluded = true;
entries[0].forEach((entry) => {
if (
entry &&
entry.reference &&
- typeof entry.reference === "object"
+ typeof entry.reference === 'object'
) {
entry.reference.forEach((reference) => {
- if (reference && "title" in reference) {
+ if (reference && 'title' in reference) {
allReferencesExcluded = false;
}
});
@@ -1167,184 +1167,184 @@ describe("ContentStack SDK Tests", () => {
});
});
- describe("Taxonomies Endpoint Tests", () => {
- describe("Get Entries With One Term", () => {
+ describe('Taxonomies Endpoint Tests', () => {
+ describe('Get Entries With One Term', () => {
let entries;
beforeAll(async () => {
const Query = Stack.Taxonomies();
- entries = await Query.where("taxonomies.one", "term_one")
+ entries = await Query.where('taxonomies.one', 'term_one')
.toJSON()
.find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
});
- describe("Get Entries With Any Term ($in)", () => {
+ describe('Get Entries With Any Term ($in)', () => {
let entries;
beforeAll(async () => {
const Query = Stack.Taxonomies();
- entries = await Query.containedIn("taxonomies.one", [
- "term_one",
- "term_two",
+ entries = await Query.containedIn('taxonomies.one', [
+ 'term_one',
+ 'term_two'
])
.toJSON()
.find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
});
- describe("Get Entries With Any Term ($or)", () => {
+ describe('Get Entries With Any Term ($or)', () => {
let entries;
beforeAll(async () => {
- const Query1 = Stack.Taxonomies().where("taxonomies.one", "term_one");
- const Query2 = Stack.Taxonomies().where("taxonomies.two", "term_two");
+ const Query1 = Stack.Taxonomies().where('taxonomies.one', 'term_one');
+ const Query2 = Stack.Taxonomies().where('taxonomies.two', 'term_two');
const Query = Stack.Taxonomies();
entries = await Query.or(Query1, Query2).toJSON().find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
});
- describe("Get Entries With All Terms ($and)", () => {
+ describe('Get Entries With All Terms ($and)', () => {
let entries;
beforeAll(async () => {
- const Query1 = Stack.Taxonomies().where("taxonomies.one", "term_one");
- const Query2 = Stack.Taxonomies().where("taxonomies.two", "term_two");
+ const Query1 = Stack.Taxonomies().where('taxonomies.one', 'term_one');
+ const Query2 = Stack.Taxonomies().where('taxonomies.two', 'term_two');
const Query = Stack.Taxonomies();
entries = await Query.and(Query1, Query2).toJSON().find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
});
- describe("Get Entries With Any Taxonomy Terms ($exists)", () => {
+ describe('Get Entries With Any Taxonomy Terms ($exists)', () => {
let entries;
beforeAll(async () => {
const Query = Stack.Taxonomies();
- entries = await Query.exists("taxonomies.one").toJSON().find();
+ entries = await Query.exists('taxonomies.one').toJSON().find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
});
});
- describe("Content Type Taxonomies Query Tests", () => {
- describe("Get Entries With One Term", () => {
+ describe('Content Type Taxonomies Query Tests', () => {
+ describe('Get Entries With One Term', () => {
let entries;
beforeAll(async () => {
- const Query = Stack.ContentType("source").Query();
- entries = await Query.where("taxonomies.one", "term_one")
+ const Query = Stack.ContentType('source').Query();
+ entries = await Query.where('taxonomies.one', 'term_one')
.toJSON()
.find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
});
- describe("Get Entries With Any Term ($in)", () => {
+ describe('Get Entries With Any Term ($in)', () => {
let entries;
beforeAll(async () => {
- const Query = Stack.ContentType("source").Query();
- entries = await Query.containedIn("taxonomies.one", [
- "term_one",
- "term_two",
+ const Query = Stack.ContentType('source').Query();
+ entries = await Query.containedIn('taxonomies.one', [
+ 'term_one',
+ 'term_two'
])
.toJSON()
.find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
});
- describe("Get Entries With Any Term ($or)", () => {
+ describe('Get Entries With Any Term ($or)', () => {
let entries;
beforeAll(async () => {
- const Query1 = Stack.ContentType("source")
+ const Query1 = Stack.ContentType('source')
.Query()
- .where("taxonomies.one", "term_one");
- const Query2 = Stack.ContentType("source")
+ .where('taxonomies.one', 'term_one');
+ const Query2 = Stack.ContentType('source')
.Query()
- .where("taxonomies.two", "term_two");
- const Query = Stack.ContentType("source").Query();
+ .where('taxonomies.two', 'term_two');
+ const Query = Stack.ContentType('source').Query();
entries = await Query.or(Query1, Query2).toJSON().find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
});
- describe("Get Entries With All Terms ($and)", () => {
+ describe('Get Entries With All Terms ($and)', () => {
let entries;
beforeAll(async () => {
- const Query1 = Stack.ContentType("source")
+ const Query1 = Stack.ContentType('source')
.Query()
- .where("taxonomies.one", "term_one");
- const Query2 = Stack.ContentType("source")
+ .where('taxonomies.one', 'term_one');
+ const Query2 = Stack.ContentType('source')
.Query()
- .where("taxonomies.two", "term_two");
- const Query = Stack.ContentType("source").Query();
+ .where('taxonomies.two', 'term_two');
+ const Query = Stack.ContentType('source').Query();
entries = await Query.and(Query1, Query2).toJSON().find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
});
- describe("Get Entries With Any Taxonomy Terms ($exists)", () => {
+ describe('Get Entries With Any Taxonomy Terms ($exists)', () => {
let entries;
beforeAll(async () => {
- const Query = Stack.ContentType("source").Query();
- entries = await Query.exists("taxonomies.one").toJSON().find();
+ const Query = Stack.ContentType('source').Query();
+ entries = await Query.exists('taxonomies.one').toJSON().find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
});
- describe("Get Entries With Taxonomy Terms and Also Matching Its Children Term ($eq_below, level)", () => {
+ describe('Get Entries With Taxonomy Terms and Also Matching Its Children Term ($eq_below, level)', () => {
let entries;
beforeAll(async () => {
- const Query = Stack.ContentType("source").Query();
- entries = await Query.equalAndBelow("taxonomies.one", "term_one")
+ const Query = Stack.ContentType('source').Query();
+ entries = await Query.equalAndBelow('taxonomies.one', 'term_one')
.toJSON()
.find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
});
@@ -1353,59 +1353,59 @@ describe("ContentStack SDK Tests", () => {
let entries;
beforeAll(async () => {
- const Query = Stack.ContentType("source").Query();
- entries = await Query.below("taxonomies.one", "term_one")
+ const Query = Stack.ContentType('source').Query();
+ entries = await Query.below('taxonomies.one', 'term_one')
.toJSON()
.find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
});
- describe("Get Entries With Taxonomy Terms and Also Matching Its Parent Term ($eq_above, level)", () => {
+ describe('Get Entries With Taxonomy Terms and Also Matching Its Parent Term ($eq_above, level)', () => {
let entries;
beforeAll(async () => {
- const Query = Stack.ContentType("source").Query();
- entries = await Query.equalAndAbove("taxonomies.one", "term_one")
+ const Query = Stack.ContentType('source').Query();
+ entries = await Query.equalAndAbove('taxonomies.one', 'term_one')
.toJSON()
.find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
});
- describe("Get Entries With Taxonomy Terms Parent and Excluding the term itself ($above, level)", () => {
+ describe('Get Entries With Taxonomy Terms Parent and Excluding the term itself ($above, level)', () => {
let entries;
beforeAll(async () => {
- const Query = Stack.ContentType("source").Query();
- entries = await Query.above("taxonomies.one", "term_one_child")
+ const Query = Stack.ContentType('source').Query();
+ entries = await Query.above('taxonomies.one', 'term_one_child')
.toJSON()
.find();
});
- test("Should return entries in the resultset", () => {
+ test('Should return entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
});
});
- describe("Variants Tests", () => {
- describe("Variants in entry", () => {
+ describe('Variants Tests', () => {
+ describe('Variants in entry', () => {
let entries;
beforeAll(async () => {
- const Query = Stack.ContentType("source").Query();
- entries = await Query.variants(["variant_entry_1", "variant_entry_2"])
+ const Query = Stack.ContentType('source').Query();
+ entries = await Query.variants(['variant_entry_1', 'variant_entry_2'])
.toJSON()
.find();
});
- test("Should return variant entries in the resultset", () => {
+ test('Should return variant entries in the resultset', () => {
expect(entries[0].length).toBeTruthy();
});
});
diff --git a/test/entry/findone-result-wrapper.js b/test/entry/findone-result-wrapper.js
index af8e7774..fffcab65 100755
--- a/test/entry/findone-result-wrapper.js
+++ b/test/entry/findone-result-wrapper.js
@@ -1,16 +1,16 @@
-"use strict";
+'use strict';
/*
* Module Dependencies.
*/
-const Contentstack = require("../../dist/node/contentstack.js");
-const Utils = require("./utils.js");
-const init = require("../config.js");
+const Contentstack = require('../../dist/node/contentstack.js');
+const Utils = require('./utils.js');
+const init = require('../config.js');
const contentTypes = init.contentTypes;
let Stack;
-describe("FindOne Tests", () => {
+describe('FindOne Tests', () => {
// Setup - Initialize the Contentstack Stack Instance
beforeAll((done) => {
Stack = Contentstack.Stack(init.stack);
@@ -18,67 +18,64 @@ describe("FindOne Tests", () => {
setTimeout(done, 1000);
});
- describe("Default FindOne", () => {
+ describe('Default FindOne', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
entry = await Query.toJSON().findOne();
});
- test("Should return an entry with uid, locale, publish_details", () => {
+ test('Should return an entry with uid, locale, publish_details', () => {
expect(entry).toBeDefined();
- expect(entry["uid"]).toBeDefined();
- expect(entry["locale"]).toBeDefined();
- expect(entry["publish_details"]).toBeDefined();
+ expect(entry.uid).toBeDefined();
+ expect(entry.locale).toBeDefined();
+ expect(entry.publish_details).toBeDefined();
});
});
// SORTING TESTS
- describe("Sorting", () => {
- describe("Ascending", () => {
+ describe('Sorting', () => {
+ describe('Ascending', () => {
let entry;
- let error = null;
- const field = "updated_at";
+ const field = 'updated_at';
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
entry = await Query.ascending(field).toJSON().findOne();
});
- test("Should return an entry with uid, locale, publish_details", () => {
+ test('Should return an entry with uid, locale, publish_details', () => {
expect(entry).toBeDefined();
- expect(entry["uid"]).toBeDefined();
- expect(entry["locale"]).toBeDefined();
- expect(entry["publish_details"]).toBeDefined();
+ expect(entry.uid).toBeDefined();
+ expect(entry.locale).toBeDefined();
+ expect(entry.publish_details).toBeDefined();
});
});
- describe("Descending", () => {
+ describe('Descending', () => {
let entry;
- const field = "created_at";
+ const field = 'created_at';
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
entry = await Query.descending(field).toJSON().findOne();
});
- test("Should return an entry with uid, locale, publish_details", () => {
+ test('Should return an entry with uid, locale, publish_details', () => {
expect(entry).toBeDefined();
- expect(entry["uid"]).toBeDefined();
- expect(entry["locale"]).toBeDefined();
- expect(entry["publish_details"]).toBeDefined();
+ expect(entry.uid).toBeDefined();
+ expect(entry.locale).toBeDefined();
+ expect(entry.publish_details).toBeDefined();
});
});
});
// COMPARISON TESTS
- describe("Comparison", () => {
- describe("lessThan", () => {
+ describe('Comparison', () => {
+ describe('lessThan', () => {
let entry;
- let error = null;
- const field = "num_field";
+ const field = 'num_field';
const value = 11;
beforeAll(async () => {
@@ -88,22 +85,21 @@ describe("FindOne Tests", () => {
entry = await Query.lessThan(field, value).toJSON().findOne();
});
- test("Should return an entry with uid, locale, publish_details", () => {
+ test('Should return an entry with uid, locale, publish_details', () => {
expect(entry).toBeDefined();
- expect(entry["uid"]).toBeDefined();
- expect(entry["locale"]).toBeDefined();
- expect(entry["publish_details"]).toBeDefined();
+ expect(entry.uid).toBeDefined();
+ expect(entry.locale).toBeDefined();
+ expect(entry.publish_details).toBeDefined();
});
- test("num_field should be less than specified value", () => {
+ test('num_field should be less than specified value', () => {
expect(entry[field]).toBeLessThan(value);
});
});
- describe("lessThanOrEqualTo", () => {
+ describe('lessThanOrEqualTo', () => {
let entry;
- let error = null;
- const field = "num_field";
+ const field = 'num_field';
const value = 11;
beforeAll(async () => {
@@ -112,21 +108,20 @@ describe("FindOne Tests", () => {
).Query();
entry = await Query.lessThanOrEqualTo(field, value).toJSON().findOne();
});
- test("Should return an entry with uid, locale, publish_details", () => {
+ test('Should return an entry with uid, locale, publish_details', () => {
expect(entry).toBeDefined();
- expect(entry["uid"]).toBeDefined();
- expect(entry["locale"]).toBeDefined();
- expect(entry["publish_details"]).toBeDefined();
+ expect(entry.uid).toBeDefined();
+ expect(entry.locale).toBeDefined();
+ expect(entry.publish_details).toBeDefined();
});
- test("num_field should be less than or equal to specified value", () => {
+ test('num_field should be less than or equal to specified value', () => {
expect(entry[field]).toBeLessThanOrEqual(value);
});
});
- describe("greaterThan", () => {
+ describe('greaterThan', () => {
let entry;
- let error = null;
- const field = "num_field";
+ const field = 'num_field';
const value = 6;
beforeAll(async () => {
@@ -139,22 +134,21 @@ describe("FindOne Tests", () => {
.findOne();
});
- test("Should return an entry with uid, locale, publish_details", () => {
+ test('Should return an entry with uid, locale, publish_details', () => {
expect(entry).toBeDefined();
- expect(entry["uid"]).toBeDefined();
- expect(entry["locale"]).toBeDefined();
- expect(entry["publish_details"]).toBeDefined();
+ expect(entry.uid).toBeDefined();
+ expect(entry.locale).toBeDefined();
+ expect(entry.publish_details).toBeDefined();
});
- test("num_field should be greater than specified value", () => {
+ test('num_field should be greater than specified value', () => {
expect(entry[field]).toBeGreaterThan(value);
});
});
- describe("greaterThanOrEqualTo", () => {
+ describe('greaterThanOrEqualTo', () => {
let entry;
- let error = null;
- const field = "num_field";
+ const field = 'num_field';
const value = 11;
beforeAll(async () => {
@@ -167,22 +161,21 @@ describe("FindOne Tests", () => {
.findOne();
});
- test("Should return an entry with uid, locale, publish_details", () => {
+ test('Should return an entry with uid, locale, publish_details', () => {
expect(entry).toBeDefined();
- expect(entry["uid"]).toBeDefined();
- expect(entry["locale"]).toBeDefined();
- expect(entry["publish_details"]).toBeDefined();
+ expect(entry.uid).toBeDefined();
+ expect(entry.locale).toBeDefined();
+ expect(entry.publish_details).toBeDefined();
});
- test("num_field should be greater than or equal to specified value", () => {
+ test('num_field should be greater than or equal to specified value', () => {
expect(entry[field]).toBeGreaterThanOrEqual(value);
});
});
- describe("notEqualTo", () => {
+ describe('notEqualTo', () => {
let entry;
- let error = null;
- const field = "num_field";
+ const field = 'num_field';
const value = 6;
beforeAll(async () => {
@@ -195,78 +188,76 @@ describe("FindOne Tests", () => {
.findOne();
});
- test("num_field should not be equal to specified value", () => {
+ test('num_field should not be equal to specified value', () => {
expect(entry[field]).not.toBe(value);
});
- test("Should return an entry with uid, locale, publish_details", () => {
+ test('Should return an entry with uid, locale, publish_details', () => {
expect(entry).toBeDefined();
- expect(entry["uid"]).toBeDefined();
- expect(entry["locale"]).toBeDefined();
- expect(entry["publish_details"]).toBeDefined();
+ expect(entry.uid).toBeDefined();
+ expect(entry.locale).toBeDefined();
+ expect(entry.publish_details).toBeDefined();
});
});
});
// ARRAY/SUBSET TESTS
- describe("Array/Subset", () => {
- describe("containedIn", () => {
+ describe('Array/Subset', () => {
+ describe('containedIn', () => {
let entry;
- let error = null;
- const _in = ["source1", "source2"];
+ const _in = ['source1', 'source2'];
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.containedIn("title", _in).toJSON().findOne();
+ entry = await Query.containedIn('title', _in).toJSON().findOne();
});
- test("Entry title should be in the specified values", () => {
+ test('Entry title should be in the specified values', () => {
expect(_in).toContain(entry.title);
});
- test("Should return an entry with uid, locale, publish_details", () => {
+ test('Should return an entry with uid, locale, publish_details', () => {
expect(entry).toBeDefined();
- expect(entry["uid"]).toBeDefined();
- expect(entry["locale"]).toBeDefined();
- expect(entry["publish_details"]).toBeDefined();
+ expect(entry.uid).toBeDefined();
+ expect(entry.locale).toBeDefined();
+ expect(entry.publish_details).toBeDefined();
});
});
- describe("notContainedIn", () => {
+ describe('notContainedIn', () => {
let entry;
- let error = null;
- const _in = ["source1"];
+ const _in = ['source1'];
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.notContainedIn("title", _in).toJSON().findOne();
+ entry = await Query.notContainedIn('title', _in).toJSON().findOne();
});
- test("Should either return an entry with matching criteria or an expected error", () => {
+ test('Should either return an entry with matching criteria or an expected error', () => {
if (entry) {
expect(entry.title).toBeDefined();
expect(_in).not.toContain(entry.title);
} else {
expect(error).toEqual({
error_code: 141,
- error_message: "The requested entry doesn't exist.",
+ error_message: "The requested entry doesn't exist."
});
}
});
- test("If entry exists, it should have uid", () => {
+ test('If entry exists, it should have uid', () => {
if (entry) {
expect(entry.uid).toBeDefined();
}
});
- test("If entry exists, it should have locale", () => {
+ test('If entry exists, it should have locale', () => {
if (entry) {
expect(entry.locale).toBeDefined();
}
});
- test("If entry exists, it should have publish_details", () => {
+ test('If entry exists, it should have publish_details', () => {
if (entry) {
expect(entry.publish_details).toBeDefined();
}
@@ -275,74 +266,71 @@ describe("FindOne Tests", () => {
});
// ELEMENT EXISTS TESTS
- describe("Element Existence", () => {
- describe("exists", () => {
+ describe('Element Existence', () => {
+ describe('exists', () => {
let entry;
- let error = null;
- const queryField = "boolean";
+ const queryField = 'boolean';
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
entry = await Query.exists(queryField).toJSON().findOne();
});
- test("Entry should have the queried field", () => {
- expect(typeof entry[queryField]).not.toBe("undefined");
+ test('Entry should have the queried field', () => {
+ expect(typeof entry[queryField]).not.toBe('undefined');
});
- test("Should return an entry with uid, locale, publish_details", () => {
+ test('Should return an entry with uid, locale, publish_details', () => {
expect(entry).toBeDefined();
- expect(entry["uid"]).toBeDefined();
- expect(entry["locale"]).toBeDefined();
- expect(entry["publish_details"]).toBeDefined();
+ expect(entry.uid).toBeDefined();
+ expect(entry.locale).toBeDefined();
+ expect(entry.publish_details).toBeDefined();
});
});
- describe("notExists", () => {
+ describe('notExists', () => {
let entry;
- let error = null;
- const queryField = "isspecial";
+ const queryField = 'isspecial';
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
entry = await Query.notExists(queryField).toJSON().findOne();
});
- test("Should handle either success or error case", () => {
+ test('Should handle either success or error case', () => {
if (entry) {
- expect(typeof entry[queryField]).toBe("undefined");
+ expect(typeof entry[queryField]).toBe('undefined');
} else {
expect(error).toEqual({
error_code: 141,
- error_message: "The requested entry doesn't exist.",
+ error_message: "The requested entry doesn't exist."
});
}
});
- test("If entry exists, it should have uid", () => {
+ test('If entry exists, it should have uid', () => {
if (entry) {
expect(entry.uid).toBeDefined();
}
});
- test("If entry exists, it should have locale", () => {
+ test('If entry exists, it should have locale', () => {
if (entry) {
expect(entry.locale).toBeDefined();
}
});
- test("If entry exists, it should have publish_details", () => {
+ test('If entry exists, it should have publish_details', () => {
if (entry) {
expect(entry.publish_details).toBeDefined();
}
});
});
});
- describe("Pagination", () => {
- describe("skip", () => {
+ describe('Pagination', () => {
+ describe('skip', () => {
let allEntries;
let skippedEntry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
@@ -352,139 +340,133 @@ describe("FindOne Tests", () => {
skippedEntry = await skipQuery.skip(1).toJSON().findOne();
});
- test("Should have entries in the result set", () => {
+ test('Should have entries in the result set', () => {
expect(allEntries.length).toBeTruthy();
});
- test("Should get correct skipped entry", () => {
+ test('Should get correct skipped entry', () => {
expect(skippedEntry).toEqual(allEntries[0][1]);
});
});
});
- describe("Logical Operations", () => {
- describe("OR Query Objects", () => {
+ describe('Logical Operations', () => {
+ describe('OR Query Objects', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query1 = Stack.ContentType(contentTypes.source)
.Query()
- .containedIn("title", ["source1"]);
+ .containedIn('title', ['source1']);
const Query2 = Stack.ContentType(contentTypes.source)
.Query()
- .where("boolean", "false");
+ .where('boolean', 'false');
const Query = Stack.ContentType(contentTypes.source).Query();
entry = await Query.or(Query1, Query2).toJSON().findOne();
});
- test("Should return an entry with uid, locale, publish_details", () => {
+ test('Should return an entry with uid, locale, publish_details', () => {
expect(entry).toBeDefined();
- expect(entry["uid"]).toBeDefined();
- expect(entry["locale"]).toBeDefined();
- expect(entry["publish_details"]).toBeDefined();
+ expect(entry.uid).toBeDefined();
+ expect(entry.locale).toBeDefined();
+ expect(entry.publish_details).toBeDefined();
});
});
- describe("AND Query Objects", () => {
+ describe('AND Query Objects', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query1 = Stack.ContentType(contentTypes.source)
.Query()
- .containedIn("title", ["source1"]);
+ .containedIn('title', ['source1']);
const Query2 = Stack.ContentType(contentTypes.source)
.Query()
- .where("boolean", true);
+ .where('boolean', true);
const Query = Stack.ContentType(contentTypes.source).Query();
entry = await Query.and(Query1, Query2).toJSON().findOne();
});
- test("Should return an entry with uid, locale, publish_details", () => {
+ test('Should return an entry with uid, locale, publish_details', () => {
expect(entry).toBeDefined();
- expect(entry["uid"]).toBeDefined();
- expect(entry["locale"]).toBeDefined();
- expect(entry["publish_details"]).toBeDefined();
+ expect(entry.uid).toBeDefined();
+ expect(entry.locale).toBeDefined();
+ expect(entry.publish_details).toBeDefined();
});
});
- describe("Raw Query", () => {
+ describe('Raw Query', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
entry = await Query.query({
- $or: [{ title: "source1" }, { boolean: "false" }],
+ $or: [{ title: 'source1' }, { boolean: 'false' }]
})
.toJSON()
.findOne();
});
- test("Entry should satisfy OR condition", () => {
+ test('Entry should satisfy OR condition', () => {
expect(
- entry.title === "source1" || entry.boolean === false
+ entry.title === 'source1' || entry.boolean === false
).toBeTruthy();
});
- test("Should return an entry with uid, locale, publish_details", () => {
+ test('Should return an entry with uid, locale, publish_details', () => {
expect(entry).toBeDefined();
- expect(entry["uid"]).toBeDefined();
- expect(entry["locale"]).toBeDefined();
- expect(entry["publish_details"]).toBeDefined();
+ expect(entry.uid).toBeDefined();
+ expect(entry.locale).toBeDefined();
+ expect(entry.publish_details).toBeDefined();
});
});
});
- describe("Tags", () => {
+ describe('Tags', () => {
let entry;
- let error = null;
- const tags = ["tag1", "tag2"];
+ const tags = ['tag1', 'tag2'];
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
entry = await Query.tags(tags).toJSON().findOne();
});
- test("Tags specified should be found in the result", () => {
+ test('Tags specified should be found in the result', () => {
expect(Utils.arrayPresentInArray(tags, entry.tags) > 0).toBe(true);
});
- test("Should return an entry with uid, locale, publish_details", () => {
+ test('Should return an entry with uid, locale, publish_details', () => {
expect(entry).toBeDefined();
- expect(entry["uid"]).toBeDefined();
- expect(entry["locale"]).toBeDefined();
- expect(entry["publish_details"]).toBeDefined();
+ expect(entry.uid).toBeDefined();
+ expect(entry.locale).toBeDefined();
+ expect(entry.publish_details).toBeDefined();
});
});
- describe("Search", () => {
+ describe('Search', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.search("source1").toJSON().findOne();
+ entry = await Query.search('source1').toJSON().findOne();
});
- test("Should return an entry with uid, locale, publish_details", () => {
+ test('Should return an entry with uid, locale, publish_details', () => {
expect(entry).toBeDefined();
- expect(entry["uid"]).toBeDefined();
- expect(entry["locale"]).toBeDefined();
- expect(entry["publish_details"]).toBeDefined();
+ expect(entry.uid).toBeDefined();
+ expect(entry.locale).toBeDefined();
+ expect(entry.publish_details).toBeDefined();
});
});
- describe("Regex", () => {
+ describe('Regex', () => {
let entry;
- let error = null;
- const field = "title";
+ const field = 'title';
const regex = {
- pattern: "^source",
- options: "i",
+ pattern: '^source',
+ options: 'i'
};
beforeAll(async () => {
@@ -494,131 +476,125 @@ describe("FindOne Tests", () => {
.findOne();
});
- test("Entry field should match the regex pattern", () => {
+ test('Entry field should match the regex pattern', () => {
const regExp = new RegExp(regex.pattern, regex.options);
expect(regExp.test(entry[field])).toBe(true);
});
- test("Should return an entry with uid, locale, publish_details", () => {
+ test('Should return an entry with uid, locale, publish_details', () => {
expect(entry).toBeDefined();
- expect(entry["uid"]).toBeDefined();
- expect(entry["locale"]).toBeDefined();
- expect(entry["publish_details"]).toBeDefined();
+ expect(entry.uid).toBeDefined();
+ expect(entry.locale).toBeDefined();
+ expect(entry.publish_details).toBeDefined();
});
});
- describe("Localization", () => {
- describe("Without Fallback", () => {
+ describe('Localization', () => {
+ describe('Without Fallback', () => {
let entry;
- let error = null;
- const _in = ["ja-jp"];
+ const _in = ['ja-jp'];
beforeAll(async () => {
entry = await Stack.ContentType(contentTypes.source)
.Query()
- .language("ja-jp")
+ .language('ja-jp')
.toJSON()
.findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Entry should have correct locale in publish_details", () => {
+ test('Entry should have correct locale in publish_details', () => {
expect(_in).toContain(entry.publish_details.locale);
});
});
- describe("With Fallback", () => {
+ describe('With Fallback', () => {
let entry;
- let error = null;
- const _in = ["ja-jp", "en-us"];
+ const _in = ['ja-jp', 'en-us'];
beforeAll(async () => {
entry = await Stack.ContentType(contentTypes.source)
.Query()
- .language("ja-jp")
+ .language('ja-jp')
.includeFallback()
.toJSON()
.findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Entry should have locale from allowed fallback list", () => {
+ test('Entry should have locale from allowed fallback list', () => {
expect(_in).toContain(entry.publish_details.locale);
});
});
});
- describe("Including References", () => {
- describe("includeReference - String", () => {
+ describe('Including References', () => {
+ describe('includeReference - String', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.includeReference("reference").toJSON().findOne();
+ entry = await Query.includeReference('reference').toJSON().findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("All present references should be included as objects", () => {
+ test('All present references should be included as objects', () => {
expect(
- entry && entry["reference"] && typeof entry["reference"] === "object"
+ entry && entry.reference && typeof entry.reference === 'object'
).toBe(true);
});
});
- describe("includeReference - Array", () => {
+ describe('includeReference - Array', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.includeReference(["reference", "other_reference"])
+ entry = await Query.includeReference(['reference', 'other_reference'])
.toJSON()
.findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("All present references should be included as objects", () => {
+ test('All present references should be included as objects', () => {
const condition =
entry &&
- entry["reference"] &&
- typeof entry["reference"] === "object" &&
+ entry.reference &&
+ typeof entry.reference === 'object' &&
entry.other_reference &&
- typeof entry.other_reference === "object";
+ typeof entry.other_reference === 'object';
expect(condition).toBe(true);
});
});
});
- describe("Including Schema", () => {
+ describe('Including Schema', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
entry = await Query.includeSchema().toJSON().findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
});
- describe("Including ContentType", () => {
+ describe('Including ContentType', () => {
let entry;
let contentType;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
@@ -630,19 +606,18 @@ describe("FindOne Tests", () => {
});
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("ContentType should not be present", () => {
- expect(typeof contentType).toBe("undefined");
+ test('ContentType should not be present', () => {
+ expect(typeof contentType).toBe('undefined');
});
});
- describe("Including Schema and ContentType", () => {
+ describe('Including Schema and ContentType', () => {
let entry;
let contentType;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
@@ -655,103 +630,99 @@ describe("FindOne Tests", () => {
});
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("ContentType should not be present", () => {
- expect(typeof contentType).toBe("undefined");
+ test('ContentType should not be present', () => {
+ expect(typeof contentType).toBe('undefined');
});
});
- describe("Field Selection - Only", () => {
- describe("only - Single String Parameter", () => {
+ describe('Field Selection - Only', () => {
+ describe('only - Single String Parameter', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.only("title").toJSON().findOne();
+ entry = await Query.only('title').toJSON().findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Entry should only contain title and uid fields", () => {
+ test('Entry should only contain title and uid fields', () => {
expect(Object.keys(entry).length).toBe(2);
- expect(entry).toHaveProperty("title");
- expect(entry).toHaveProperty("uid");
+ expect(entry).toHaveProperty('title');
+ expect(entry).toHaveProperty('uid');
});
});
- describe("only - Multiple String Parameters", () => {
+ describe('only - Multiple String Parameters', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.only("BASE", "title").toJSON().findOne();
+ entry = await Query.only('BASE', 'title').toJSON().findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Entry should only contain title and uid fields", () => {
+ test('Entry should only contain title and uid fields', () => {
expect(Object.keys(entry).length).toBe(2);
- expect(entry).toHaveProperty("title");
- expect(entry).toHaveProperty("uid");
+ expect(entry).toHaveProperty('title');
+ expect(entry).toHaveProperty('uid');
});
});
- describe("only - Array Parameter", () => {
+ describe('only - Array Parameter', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.only(["title", "url"]).toJSON().findOne();
+ entry = await Query.only(['title', 'url']).toJSON().findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Entry should contain title, url, and uid fields", () => {
+ test('Entry should contain title, url, and uid fields', () => {
expect(Object.keys(entry).length).toBe(3);
- expect(entry).toHaveProperty("title");
- expect(entry).toHaveProperty("url");
- expect(entry).toHaveProperty("uid");
+ expect(entry).toHaveProperty('title');
+ expect(entry).toHaveProperty('url');
+ expect(entry).toHaveProperty('uid');
});
});
- describe("only - For reference - String", () => {
+ describe('only - For reference - String', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.includeReference("reference")
- .only("BASE", "reference")
- .only("reference", "title")
+ entry = await Query.includeReference('reference')
+ .only('BASE', 'reference')
+ .only('reference', 'title')
.toJSON()
.findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Reference fields should be properly filtered", () => {
+ test('Reference fields should be properly filtered', () => {
let hasProperReferences = false;
if (
entry &&
- entry["reference"] &&
- typeof entry["reference"] === "object"
+ entry.reference &&
+ typeof entry.reference === 'object'
) {
- hasProperReferences = entry["reference"].every(
- (ref) => ref && "title" in ref && "uid" in ref
+ hasProperReferences = entry.reference.every(
+ (ref) => ref && 'title' in ref && 'uid' in ref
);
} else {
hasProperReferences = true; // No references or empty references is valid
@@ -760,32 +731,31 @@ describe("FindOne Tests", () => {
});
});
- describe("only - For reference - Array", () => {
+ describe('only - For reference - Array', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.includeReference("reference")
- .only("BASE", ["reference"])
- .only("reference", ["title"])
+ entry = await Query.includeReference('reference')
+ .only('BASE', ['reference'])
+ .only('reference', ['title'])
.toJSON()
.findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("References should have only specified fields", () => {
+ test('References should have only specified fields', () => {
let hasProperReferences = false;
- if (entry && entry["reference"]) {
- if (Array.isArray(entry["reference"])) {
- if (entry["reference"].length === 0) {
+ if (entry && entry.reference) {
+ if (Array.isArray(entry.reference)) {
+ if (entry.reference.length === 0) {
hasProperReferences = true;
} else {
- hasProperReferences = entry["reference"].every(
- (ref) => ref && "title" in ref && "uid" in ref
+ hasProperReferences = entry.reference.every(
+ (ref) => ref && 'title' in ref && 'uid' in ref
);
}
} else {
@@ -799,91 +769,87 @@ describe("FindOne Tests", () => {
});
});
- describe("Field Selection - Except", () => {
- describe("except - Single String Parameter", () => {
+ describe('Field Selection - Except', () => {
+ describe('except - Single String Parameter', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.except("title").toJSON().findOne();
+ entry = await Query.except('title').toJSON().findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Entry should not contain the excluded field", () => {
- expect(entry).not.toHaveProperty("title");
+ test('Entry should not contain the excluded field', () => {
+ expect(entry).not.toHaveProperty('title');
});
});
- describe("except - Multiple String Parameters", () => {
+ describe('except - Multiple String Parameters', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.except("BASE", "title").toJSON().findOne();
+ entry = await Query.except('BASE', 'title').toJSON().findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Entry should not contain the excluded field", () => {
- expect(entry).not.toHaveProperty("title");
+ test('Entry should not contain the excluded field', () => {
+ expect(entry).not.toHaveProperty('title');
});
});
- describe("except - Array of String Parameters", () => {
+ describe('except - Array of String Parameters', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.except(["title", "url"]).toJSON().findOne();
+ entry = await Query.except(['title', 'url']).toJSON().findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Entry should not contain the first excluded field", () => {
- expect(entry).not.toHaveProperty("title");
+ test('Entry should not contain the first excluded field', () => {
+ expect(entry).not.toHaveProperty('title');
});
- test("Entry should not contain the second excluded field", () => {
- expect(entry).not.toHaveProperty("url");
+ test('Entry should not contain the second excluded field', () => {
+ expect(entry).not.toHaveProperty('url');
});
});
- describe("except - For the reference - String", () => {
+ describe('except - For the reference - String', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.includeReference("reference")
- .only("BASE", "reference")
- .except("reference", "title")
+ entry = await Query.includeReference('reference')
+ .only('BASE', 'reference')
+ .except('reference', 'title')
.toJSON()
.findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("References should not contain the excluded field", () => {
+ test('References should not contain the excluded field', () => {
let hasProperExclusions = false;
if (
entry &&
- entry["reference"] &&
- typeof entry["reference"] === "object"
+ entry.reference &&
+ typeof entry.reference === 'object'
) {
- hasProperExclusions = entry["reference"].every(
- (ref) => ref && !("title" in ref)
+ hasProperExclusions = entry.reference.every(
+ (ref) => ref && !('title' in ref)
);
} else {
// No references is valid for this test
@@ -893,32 +859,31 @@ describe("FindOne Tests", () => {
});
});
- describe("except - For the reference - Array", () => {
+ describe('except - For the reference - Array', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.includeReference("reference")
- .only("BASE", ["reference"])
- .except("reference", ["title"])
+ entry = await Query.includeReference('reference')
+ .only('BASE', ['reference'])
+ .except('reference', ['title'])
.toJSON()
.findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("References should not contain the excluded field", () => {
+ test('References should not contain the excluded field', () => {
let hasProperExclusions = false;
if (
entry &&
- entry["reference"] &&
- typeof entry["reference"] === "object"
+ entry.reference &&
+ typeof entry.reference === 'object'
) {
- hasProperExclusions = entry["reference"].every(
- (ref) => ref && !("title" in ref)
+ hasProperExclusions = entry.reference.every(
+ (ref) => ref && !('title' in ref)
);
} else {
hasProperExclusions = true;
diff --git a/test/entry/findone.js b/test/entry/findone.js
index e63d74be..99d4b403 100755
--- a/test/entry/findone.js
+++ b/test/entry/findone.js
@@ -1,16 +1,15 @@
-"use strict";
+'use strict';
/*
* Module Dependencies.
*/
-const Contentstack = require("../../dist/node/contentstack.js");
-const Utils = require("./utils.js");
-const init = require("../config.js");
+const Contentstack = require('../../dist/node/contentstack.js');
+const init = require('../config.js');
const contentTypes = init.contentTypes;
let Stack;
-describe("FindOne Tests", () => {
+describe('FindOne Tests', () => {
// Setup - Initialize the Contentstack Stack Instance
beforeAll((done) => {
Stack = Contentstack.Stack(init.stack);
@@ -18,201 +17,194 @@ describe("FindOne Tests", () => {
setTimeout(done, 1000);
});
- describe("Default FindOne", () => {
+ describe('Default FindOne', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
entry = await Query.toJSON().findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Entry should have uid", () => {
+ test('Entry should have uid', () => {
expect(entry.uid).toBeDefined();
});
- test("Entry should have locale", () => {
+ test('Entry should have locale', () => {
expect(entry.locale).toBeDefined();
});
- test("Entry should have publish_details", () => {
+ test('Entry should have publish_details', () => {
expect(entry.publish_details).toBeDefined();
});
});
- describe("Sorting", () => {
- describe("Ascending", () => {
+ describe('Sorting', () => {
+ describe('Ascending', () => {
let entry;
- let error = null;
- const field = "created_at";
+ const field = 'created_at';
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
entry = await Query.ascending(field).toJSON().findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Entry should have uid", () => {
+ test('Entry should have uid', () => {
expect(entry.uid).toBeDefined();
});
- test("Entry should have locale", () => {
+ test('Entry should have locale', () => {
expect(entry.locale).toBeDefined();
});
- test("Entry should have publish_details", () => {
+ test('Entry should have publish_details', () => {
expect(entry.publish_details).toBeDefined();
});
});
- describe("Descending", () => {
+ describe('Descending', () => {
let entry;
- let error = null;
- const field = "created_at";
+ const field = 'created_at';
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
entry = await Query.descending(field).toJSON().findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Entry should have uid", () => {
+ test('Entry should have uid', () => {
expect(entry.uid).toBeDefined();
});
- test("Entry should have locale", () => {
+ test('Entry should have locale', () => {
expect(entry.locale).toBeDefined();
});
- test("Entry should have publish_details", () => {
+ test('Entry should have publish_details', () => {
expect(entry.publish_details).toBeDefined();
});
});
});
- describe("Comparison", () => {
- describe("lessThan", () => {
+ describe('Comparison', () => {
+ describe('lessThan', () => {
let entry;
- let error = null;
const value = 11;
beforeAll(async () => {
const Query = Stack.ContentType(
contentTypes.numbers_content_type
).Query();
- entry = await Query.lessThan("num_field", value).toJSON().findOne();
+ entry = await Query.lessThan('num_field', value).toJSON().findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("num_field should be less than specified value", () => {
+ test('num_field should be less than specified value', () => {
expect(entry.num_field).toBeLessThan(value);
});
- test("Entry should have uid", () => {
+ test('Entry should have uid', () => {
expect(entry.uid).toBeDefined();
});
- test("Entry should have locale", () => {
+ test('Entry should have locale', () => {
expect(entry.locale).toBeDefined();
});
- test("Entry should have publish_details", () => {
+ test('Entry should have publish_details', () => {
expect(entry.publish_details).toBeDefined();
});
});
- describe("lessThanOrEqualTo", () => {
+ describe('lessThanOrEqualTo', () => {
let entry;
- let error = null;
const value = 11;
beforeAll(async () => {
const Query = Stack.ContentType(
contentTypes.numbers_content_type
).Query();
- entry = await Query.lessThanOrEqualTo("num_field", value)
+ entry = await Query.lessThanOrEqualTo('num_field', value)
.toJSON()
.findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("num_field should be less than or equal to specified value", () => {
+ test('num_field should be less than or equal to specified value', () => {
expect(entry.num_field).toBeLessThanOrEqual(value);
});
- test("Entry should have uid", () => {
+ test('Entry should have uid', () => {
expect(entry.uid).toBeDefined();
});
- test("Entry should have locale", () => {
+ test('Entry should have locale', () => {
expect(entry.locale).toBeDefined();
});
- test("Entry should have publish_details", () => {
+ test('Entry should have publish_details', () => {
expect(entry.publish_details).toBeDefined();
});
});
});
- describe("Array/Subset", () => {
- describe("containedIn", () => {
+ describe('Array/Subset', () => {
+ describe('containedIn', () => {
let entry;
- let error = null;
- const _in = ["source1", "source2"];
+ const _in = ['source1', 'source2'];
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.containedIn("title", _in).toJSON().findOne();
+ entry = await Query.containedIn('title', _in).toJSON().findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Entry title should be in the specified values", () => {
+ test('Entry title should be in the specified values', () => {
expect(_in).toContain(entry.title);
});
- test("Entry should have uid", () => {
+ test('Entry should have uid', () => {
expect(entry.uid).toBeDefined();
});
- test("Entry should have locale", () => {
+ test('Entry should have locale', () => {
expect(entry.locale).toBeDefined();
});
- test("Entry should have publish_details", () => {
+ test('Entry should have publish_details', () => {
expect(entry.publish_details).toBeDefined();
});
});
- describe("notContainedIn", () => {
+ describe('notContainedIn', () => {
let entry;
- let error = null;
- const _in = ["source1", "source2", "source3", "source4"];
+ const _in = ['source1', 'source2', 'source3', 'source4'];
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.notContainedIn("title", _in).toJSON().findOne();
+ entry = await Query.notContainedIn('title', _in).toJSON().findOne();
});
- test("Should either return an entry or an expected error", () => {
+ test('Should either return an entry or an expected error', () => {
if (entry) {
expect(entry).toBeDefined();
expect(_in).not.toContain(entry.title);
@@ -222,76 +214,73 @@ describe("FindOne Tests", () => {
} else {
expect(error).toEqual({
error_code: 141,
- error_message: "The requested entry doesn't exist.",
+ error_message: "The requested entry doesn't exist."
});
}
});
});
});
- describe("Element Existence", () => {
- describe("exists", () => {
+ describe('Element Existence', () => {
+ describe('exists', () => {
let entry;
- let error = null;
- const queryField = "boolean";
+ const queryField = 'boolean';
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
entry = await Query.exists(queryField).toJSON().findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Entry should have the queried field", () => {
- expect(typeof entry[queryField]).not.toBe("undefined");
+ test('Entry should have the queried field', () => {
+ expect(typeof entry[queryField]).not.toBe('undefined');
});
- test("Entry should have uid", () => {
+ test('Entry should have uid', () => {
expect(entry.uid).toBeDefined();
});
- test("Entry should have locale", () => {
+ test('Entry should have locale', () => {
expect(entry.locale).toBeDefined();
});
- test("Entry should have publish_details", () => {
+ test('Entry should have publish_details', () => {
expect(entry.publish_details).toBeDefined();
});
});
- describe("notExists", () => {
+ describe('notExists', () => {
let entry;
- let error = null;
- const queryField = "isspecial";
+ const queryField = 'isspecial';
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
entry = await Query.notExists(queryField).toJSON().findOne();
});
- test("Should either have entry without field or proper error", () => {
+ test('Should either have entry without field or proper error', () => {
if (entry) {
- expect(typeof entry[queryField]).toBe("undefined");
+ expect(typeof entry[queryField]).toBe('undefined');
expect(entry.uid).toBeDefined();
expect(entry.locale).toBeDefined();
expect(entry.publish_details).toBeDefined();
} else {
expect(error).toEqual({
error_code: 141,
- error_message: "The requested entry doesn't exist.",
+ error_message: "The requested entry doesn't exist."
});
}
});
});
});
- describe("Pagination", () => {
- describe("skip", () => {
+ describe('Pagination', () => {
+ describe('skip', () => {
let allEntries;
let skippedEntry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
@@ -301,244 +290,235 @@ describe("FindOne Tests", () => {
skippedEntry = await SkipQuery.skip(1).toJSON().findOne();
});
- test("Should have entries in the result set", () => {
+ test('Should have entries in the result set', () => {
expect(allEntries.length).toBeTruthy();
});
- test("Should get correct skipped entry", () => {
+ test('Should get correct skipped entry', () => {
expect(skippedEntry).toEqual(allEntries[0][1]);
});
});
});
- describe("Logical Operations", () => {
- describe("OR Query Objects", () => {
+ describe('Logical Operations', () => {
+ describe('OR Query Objects', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query1 = Stack.ContentType(contentTypes.source)
.Query()
- .containedIn("title", ["source1", "source2"]);
+ .containedIn('title', ['source1', 'source2']);
const Query2 = Stack.ContentType(contentTypes.source)
.Query()
- .where("boolean", true);
+ .where('boolean', true);
const Query = Stack.ContentType(contentTypes.source).Query();
entry = await Query.or(Query1, Query2).toJSON().findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Entry should satisfy the OR condition", () => {
+ test('Entry should satisfy the OR condition', () => {
const condition =
- entry.title === "source1" ||
- entry.title === "source2" ||
+ entry.title === 'source1' ||
+ entry.title === 'source2' ||
entry.boolean === true;
expect(condition).toBeTruthy();
});
- test("Entry should have uid", () => {
+ test('Entry should have uid', () => {
expect(entry.uid).toBeDefined();
});
- test("Entry should have locale", () => {
+ test('Entry should have locale', () => {
expect(entry.locale).toBeDefined();
});
- test("Entry should have publish_details", () => {
+ test('Entry should have publish_details', () => {
expect(entry.publish_details).toBeDefined();
});
});
- describe("AND Query Objects", () => {
+ describe('AND Query Objects', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query1 = Stack.ContentType(contentTypes.source)
.Query()
- .where("title", "source1");
+ .where('title', 'source1');
const Query2 = Stack.ContentType(contentTypes.source)
.Query()
- .where("boolean", true);
+ .where('boolean', true);
const Query = Stack.ContentType(contentTypes.source).Query();
entry = await Query.and(Query1, Query2).toJSON().findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Entry should satisfy the AND condition", () => {
- const condition = entry.title === "source1" && entry.boolean === true;
+ test('Entry should satisfy the AND condition', () => {
+ const condition = entry.title === 'source1' && entry.boolean === true;
expect(condition).toBeTruthy();
});
- test("Entry should have uid", () => {
+ test('Entry should have uid', () => {
expect(entry.uid).toBeDefined();
});
- test("Entry should have locale", () => {
+ test('Entry should have locale', () => {
expect(entry.locale).toBeDefined();
});
- test("Entry should have publish_details", () => {
+ test('Entry should have publish_details', () => {
expect(entry.publish_details).toBeDefined();
});
});
- describe("Raw Query", () => {
+ describe('Raw Query', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
entry = await Query.query({
- $or: [{ title: "source1" }, { boolean: "false" }],
+ $or: [{ title: 'source1' }, { boolean: 'false' }]
})
.toJSON()
.findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Entry should satisfy the OR condition in raw query", () => {
- const condition = entry.title === "source1" || entry.boolean === false;
+ test('Entry should satisfy the OR condition in raw query', () => {
+ const condition = entry.title === 'source1' || entry.boolean === false;
expect(condition).toBeTruthy();
});
- test("Entry should have uid", () => {
+ test('Entry should have uid', () => {
expect(entry.uid).toBeDefined();
});
- test("Entry should have locale", () => {
+ test('Entry should have locale', () => {
expect(entry.locale).toBeDefined();
});
- test("Entry should have publish_details", () => {
+ test('Entry should have publish_details', () => {
expect(entry.publish_details).toBeDefined();
});
});
});
- describe("Localization", () => {
- describe("Without Fallback", () => {
+ describe('Localization', () => {
+ describe('Without Fallback', () => {
let entry;
- let error = null;
- const _in = ["ja-jp"];
+ const _in = ['ja-jp'];
beforeAll(async () => {
entry = await Stack.ContentType(contentTypes.source)
.Query()
- .language("ja-jp")
+ .language('ja-jp')
.toJSON()
.findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Entry should have correct locale in publish_details", () => {
+ test('Entry should have correct locale in publish_details', () => {
expect(_in).toContain(entry.publish_details.locale);
});
});
- describe("With Fallback", () => {
+ describe('With Fallback', () => {
let entry;
- let error = null;
- const _in = ["ja-jp", "en-us"];
+ const _in = ['ja-jp', 'en-us'];
beforeAll(async () => {
entry = await Stack.ContentType(contentTypes.source)
.Query()
- .language("ja-jp")
+ .language('ja-jp')
.includeFallback()
.toJSON()
.findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Entry should have locale from allowed fallback list", () => {
+ test('Entry should have locale from allowed fallback list', () => {
expect(_in).toContain(entry.publish_details.locale);
});
});
});
- describe("Including References", () => {
- describe("includeReference - String", () => {
+ describe('Including References', () => {
+ describe('includeReference - String', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.includeReference("reference").toJSON().findOne();
+ entry = await Query.includeReference('reference').toJSON().findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("All present references should be included as objects", () => {
+ test('All present references should be included as objects', () => {
expect(
- entry && entry.reference && typeof entry.reference === "object"
+ entry && entry.reference && typeof entry.reference === 'object'
).toBe(true);
});
});
- describe("includeReference - Array", () => {
+ describe('includeReference - Array', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.includeReference(["reference", "other_reference"])
+ entry = await Query.includeReference(['reference', 'other_reference'])
.toJSON()
.findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("All present references should be included as objects", () => {
+ test('All present references should be included as objects', () => {
const condition =
entry &&
entry.reference &&
- typeof entry.reference === "object" &&
+ typeof entry.reference === 'object' &&
entry.other_reference &&
- typeof entry.other_reference === "object";
+ typeof entry.other_reference === 'object';
expect(condition).toBe(true);
});
});
});
- describe("Including Schema", () => {
+ describe('Including Schema', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
entry = await Query.includeSchema().toJSON().findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
});
- describe("Including ContentType", () => {
+ describe('Including ContentType', () => {
let entry;
let contentType;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
@@ -550,19 +530,18 @@ describe("FindOne Tests", () => {
});
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("ContentType should not be present", () => {
- expect(typeof contentType).toBe("undefined");
+ test('ContentType should not be present', () => {
+ expect(typeof contentType).toBe('undefined');
});
});
- describe("Including Schema and ContentType", () => {
+ describe('Including Schema and ContentType', () => {
let entry;
let contentType;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
@@ -575,104 +554,100 @@ describe("FindOne Tests", () => {
});
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("ContentType should not be present", () => {
- expect(typeof contentType).toBe("undefined");
+ test('ContentType should not be present', () => {
+ expect(typeof contentType).toBe('undefined');
});
});
- describe("Field Selection - Only", () => {
- describe("only - Single String Parameter", () => {
+ describe('Field Selection - Only', () => {
+ describe('only - Single String Parameter', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.only("title").toJSON().findOne();
+ entry = await Query.only('title').toJSON().findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Entry should only contain title and uid fields", () => {
+ test('Entry should only contain title and uid fields', () => {
expect(Object.keys(entry).length).toBe(2);
- expect(entry).toHaveProperty("title");
- expect(entry).toHaveProperty("uid");
+ expect(entry).toHaveProperty('title');
+ expect(entry).toHaveProperty('uid');
});
});
- describe("only - Multiple String Parameters", () => {
+ describe('only - Multiple String Parameters', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.only("BASE", "title").toJSON().findOne();
+ entry = await Query.only('BASE', 'title').toJSON().findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Entry should only contain title and uid fields", () => {
+ test('Entry should only contain title and uid fields', () => {
expect(Object.keys(entry).length).toBe(2);
- expect(entry).toHaveProperty("title");
- expect(entry).toHaveProperty("uid");
+ expect(entry).toHaveProperty('title');
+ expect(entry).toHaveProperty('uid');
});
});
- describe("only - Array Parameter", () => {
+ describe('only - Array Parameter', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.only(["title", "url"]).toJSON().findOne();
+ entry = await Query.only(['title', 'url']).toJSON().findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Entry should contain title, url, and uid fields", () => {
+ test('Entry should contain title, url, and uid fields', () => {
expect(Object.keys(entry).length).toBe(3);
- expect(entry).toHaveProperty("title");
- expect(entry).toHaveProperty("url");
- expect(entry).toHaveProperty("uid");
+ expect(entry).toHaveProperty('title');
+ expect(entry).toHaveProperty('url');
+ expect(entry).toHaveProperty('uid');
});
});
- describe("only - For reference - String", () => {
+ describe('only - For reference - String', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.includeReference("reference")
- .only("BASE", "reference")
- .only("reference", "title")
+ entry = await Query.includeReference('reference')
+ .only('BASE', 'reference')
+ .only('reference', 'title')
.toJSON()
.findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("References should have only specified fields", () => {
+ test('References should have only specified fields', () => {
let flag = false;
if (
entry &&
- entry["reference"] &&
- typeof entry["reference"] === "object"
+ entry.reference &&
+ typeof entry.reference === 'object'
) {
flag = entry.reference.every(
(reference) =>
- reference && "title" in reference && "uid" in reference
+ reference && 'title' in reference && 'uid' in reference
);
} else {
flag = true;
@@ -681,33 +656,32 @@ describe("FindOne Tests", () => {
});
});
- describe("only - For reference - Array", () => {
+ describe('only - For reference - Array', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.includeReference("reference")
- .only("BASE", ["reference"])
- .only("reference", ["title"])
+ entry = await Query.includeReference('reference')
+ .only('BASE', ['reference'])
+ .only('reference', ['title'])
.toJSON()
.findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("References should have only specified fields", () => {
+ test('References should have only specified fields', () => {
let flag = false;
- if (entry && entry["reference"]) {
- if (entry["reference"].length) {
- if (entry["reference"].length === 0) {
+ if (entry && entry.reference) {
+ if (entry.reference.length) {
+ if (entry.reference.length === 0) {
flag = true;
} else {
flag = entry.reference.every(
(reference) =>
- reference && "title" in reference && "uid" in reference
+ reference && 'title' in reference && 'uid' in reference
);
}
} else {
@@ -721,123 +695,118 @@ describe("FindOne Tests", () => {
});
});
- describe("Field Selection - Except", () => {
- describe("except - Single String Parameter", () => {
+ describe('Field Selection - Except', () => {
+ describe('except - Single String Parameter', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.except("title").toJSON().findOne();
+ entry = await Query.except('title').toJSON().findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Entry should not contain the title field", () => {
- expect(entry).not.toHaveProperty("title");
+ test('Entry should not contain the title field', () => {
+ expect(entry).not.toHaveProperty('title');
});
});
- describe("except - Multiple String Parameters", () => {
+ describe('except - Multiple String Parameters', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.except("BASE", "title").toJSON().findOne();
+ entry = await Query.except('BASE', 'title').toJSON().findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Entry should not contain the title field", () => {
- expect(entry).not.toHaveProperty("title");
+ test('Entry should not contain the title field', () => {
+ expect(entry).not.toHaveProperty('title');
});
});
- describe("except - Array Parameter", () => {
+ describe('except - Array Parameter', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.except(["title", "file"]).toJSON().findOne();
+ entry = await Query.except(['title', 'file']).toJSON().findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("Entry should not contain the title field", () => {
- expect(entry).not.toHaveProperty("title");
+ test('Entry should not contain the title field', () => {
+ expect(entry).not.toHaveProperty('title');
});
- test("Entry should not contain the file field", () => {
- expect(entry).not.toHaveProperty("file");
+ test('Entry should not contain the file field', () => {
+ expect(entry).not.toHaveProperty('file');
});
});
- describe("except - For reference - String", () => {
+ describe('except - For reference - String', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.includeReference("reference")
- .only("BASE", "reference")
- .except("reference", "title")
+ entry = await Query.includeReference('reference')
+ .only('BASE', 'reference')
+ .except('reference', 'title')
.toJSON()
.findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("References should not contain the specified field", () => {
+ test('References should not contain the specified field', () => {
let flag = false;
if (
entry &&
- entry["reference"] &&
- typeof entry["reference"] === "object"
+ entry.reference &&
+ typeof entry.reference === 'object'
) {
flag = entry.reference.every(
- (reference) => reference && !("title" in reference)
+ (reference) => reference && !('title' in reference)
);
}
expect(flag).toBeTruthy();
});
});
- describe("except - For reference - Array", () => {
+ describe('except - For reference - Array', () => {
let entry;
- let error = null;
beforeAll(async () => {
const Query = Stack.ContentType(contentTypes.source).Query();
- entry = await Query.includeReference("reference")
- .only("BASE", ["reference"])
- .except("reference", ["title"])
+ entry = await Query.includeReference('reference')
+ .only('BASE', ['reference'])
+ .except('reference', ['title'])
.toJSON()
.findOne();
});
- test("Should return an entry", () => {
+ test('Should return an entry', () => {
expect(entry).toBeDefined();
});
- test("References should not contain the specified field", () => {
+ test('References should not contain the specified field', () => {
let flag = false;
if (
entry &&
- entry["reference"] &&
- typeof entry["reference"] === "object"
+ entry.reference &&
+ typeof entry.reference === 'object'
) {
flag = entry.reference.every(
- (reference) => reference && !("title" in reference)
+ (reference) => reference && !('title' in reference)
);
}
expect(flag).toBeTruthy();
@@ -852,7 +821,7 @@ describe("FindOne Tests", () => {
beforeAll(async () => {
try {
- const Query = Stack.ContentType("invalid_content_type").Query();
+ const Query = Stack.ContentType('invalid_content_type').Query();
await Query.toJSON().findOne();
success = true;
} catch (err) {
@@ -860,26 +829,26 @@ describe("FindOne Tests", () => {
}
});
- test("Should not succeed", () => {
+ test('Should not succeed', () => {
expect(success).toBe(false);
});
- test("Should return HTTP status 422", () => {
+ test('Should return HTTP status 422', () => {
expect(error.http_code).toBe(422);
});
- test("Should have appropriate error message", () => {
+ test('Should have appropriate error message', () => {
expect(error.http_message).toBeTruthy();
});
});
- describe("412 Unauthorized Error", () => {
+ describe('412 Unauthorized Error', () => {
let success = false;
let error = null;
beforeAll(async () => {
try {
- Stack.headers = { authorization: "InvalidAPIKey" }; // Simulating an invalid API key
+ Stack.headers = { authorization: 'InvalidAPIKey' }; // Simulating an invalid API key
const Query = Stack.ContentType(contentTypes.source).Query();
await Query.toJSON().findOne();
success = true;
@@ -891,15 +860,15 @@ describe("FindOne Tests", () => {
}
});
- test("Should not succeed", () => {
+ test('Should not succeed', () => {
expect(success).toBe(false);
});
- test("Should return HTTP status 412", () => {
+ test('Should return HTTP status 412', () => {
expect(error.http_code).toBe(412);
});
- test("Should have appropriate error message", () => {
+ test('Should have appropriate error message', () => {
expect(error.http_message).toBeTruthy();
});
});
diff --git a/test/entry/spread.js b/test/entry/spread.js
index f6395c37..c3985b49 100755
--- a/test/entry/spread.js
+++ b/test/entry/spread.js
@@ -1,18 +1,18 @@
/**
* Created by Aamod Pisat on 09-06-2017.
*/
-"use strict";
+'use strict';
/*
* Module Dependencies.
*/
-const Contentstack = require("../../dist/node/contentstack.js");
-const init = require("../config.js");
+const Contentstack = require('../../dist/node/contentstack.js');
+const init = require('../config.js');
const contentTypes = init.contentTypes;
let Stack;
-describe("Spread Method Tests", () => {
+describe('Spread Method Tests', () => {
// Setup - Initialize the Contentstack Stack Instance
beforeAll((done) => {
Stack = Contentstack.Stack(init.stack);
@@ -20,25 +20,25 @@ describe("Spread Method Tests", () => {
setTimeout(done, 1000);
});
- describe("Entries as first argument", () => {
- const field = "updated_at";
+ describe('Entries as first argument', () => {
+ const field = 'updated_at';
- test("Should have entries", () => {
+ test('Should have entries', () => {
const Query = Stack.ContentType(contentTypes.source).Query();
Query.limit(1)
.toJSON()
.find()
- .spread(function success(entries) {
+ .spread(function success (entries) {
expect(entries.length).toBeTruthy();
});
});
- test("Should maintain default sorting of descending updated_at", () => {
+ test('Should maintain default sorting of descending updated_at', () => {
const Query = Stack.ContentType(contentTypes.source).Query();
Query.limit(1)
.toJSON()
.find()
- .spread(function success(entries) {
+ .spread(function success (entries) {
if (entries && entries.length) {
let prev = entries[0][field];
const _entries = entries.every((entry) => {
@@ -51,10 +51,10 @@ describe("Spread Method Tests", () => {
});
});
- describe("With entries and count argument", () => {
- const field = "updated_at";
+ describe('With entries and count argument', () => {
+ const field = 'updated_at';
- test("Should have entries as first parameter", () => {
+ test('Should have entries as first parameter', () => {
const Query = Stack.ContentType(contentTypes.source).Query();
Query.includeCount()
.toJSON()
@@ -64,7 +64,7 @@ describe("Spread Method Tests", () => {
});
});
- test("Should have count as second parameter", () => {
+ test('Should have count as second parameter', () => {
const Query = Stack.ContentType(contentTypes.source).Query();
Query.includeCount()
.toJSON()
@@ -74,7 +74,7 @@ describe("Spread Method Tests", () => {
});
});
- test("Should maintain default sorting of descending updated_at", () => {
+ test('Should maintain default sorting of descending updated_at', () => {
const Query = Stack.ContentType(contentTypes.source).Query();
Query.includeCount()
.toJSON()
@@ -92,10 +92,10 @@ describe("Spread Method Tests", () => {
});
});
- describe("With entries, schema and count argument (includeSchema first)", () => {
- const field = "updated_at";
+ describe('With entries, schema and count argument (includeSchema first)', () => {
+ const field = 'updated_at';
- test("Should have entries as first parameter", () => {
+ test('Should have entries as first parameter', () => {
const Query = Stack.ContentType(contentTypes.source).Query();
Query.includeSchema()
.includeCount()
@@ -106,7 +106,7 @@ describe("Spread Method Tests", () => {
});
});
- test("Should have schema as second parameter", () => {
+ test('Should have schema as second parameter', () => {
const Query = Stack.ContentType(contentTypes.source).Query();
Query.includeSchema()
.includeCount()
@@ -117,7 +117,7 @@ describe("Spread Method Tests", () => {
});
});
- test("Should have count as third parameter", () => {
+ test('Should have count as third parameter', () => {
const Query = Stack.ContentType(contentTypes.source).Query();
Query.includeSchema()
.includeCount()
@@ -128,7 +128,7 @@ describe("Spread Method Tests", () => {
});
});
- test("Should maintain default sorting of descending updated_at", () => {
+ test('Should maintain default sorting of descending updated_at', () => {
const Query = Stack.ContentType(contentTypes.source).Query();
Query.includeSchema()
.includeCount()
@@ -147,10 +147,10 @@ describe("Spread Method Tests", () => {
});
});
- describe("With entries, content_type and count argument (includeContentType first)", () => {
- const field = "updated_at";
+ describe('With entries, content_type and count argument (includeContentType first)', () => {
+ const field = 'updated_at';
- test("Should have entries as first parameter", () => {
+ test('Should have entries as first parameter', () => {
const Query = Stack.ContentType(contentTypes.source).Query();
Query.includeContentType()
.includeCount()
@@ -161,7 +161,7 @@ describe("Spread Method Tests", () => {
});
});
- test("Should have contentType as second parameter", () => {
+ test('Should have contentType as second parameter', () => {
const Query = Stack.ContentType(contentTypes.source).Query();
Query.includeContentType()
.includeCount()
@@ -172,7 +172,7 @@ describe("Spread Method Tests", () => {
});
});
- test("Should have correct contentType uid", () => {
+ test('Should have correct contentType uid', () => {
const Query = Stack.ContentType(contentTypes.source).Query();
Query.includeContentType()
.includeCount()
@@ -183,7 +183,7 @@ describe("Spread Method Tests", () => {
});
});
- test("Should have count as third parameter", () => {
+ test('Should have count as third parameter', () => {
const Query = Stack.ContentType(contentTypes.source).Query();
Query.includeContentType()
.includeCount()
@@ -194,7 +194,7 @@ describe("Spread Method Tests", () => {
});
});
- test("Should maintain default sorting of descending updated_at", () => {
+ test('Should maintain default sorting of descending updated_at', () => {
const Query = Stack.ContentType(contentTypes.source).Query();
Query.includeContentType()
.includeCount()
@@ -213,10 +213,10 @@ describe("Spread Method Tests", () => {
});
});
- describe("With entries, content_type|schema and count argument", () => {
- const field = "updated_at";
+ describe('With entries, content_type|schema and count argument', () => {
+ const field = 'updated_at';
- test("Should have entries as first parameter", () => {
+ test('Should have entries as first parameter', () => {
const Query = Stack.ContentType(contentTypes.source).Query();
Query.includeCount()
.includeSchema()
@@ -228,7 +228,7 @@ describe("Spread Method Tests", () => {
});
});
- test("Should have contentType as second parameter", () => {
+ test('Should have contentType as second parameter', () => {
const Query = Stack.ContentType(contentTypes.source).Query();
Query.includeCount()
.includeSchema()
@@ -240,7 +240,7 @@ describe("Spread Method Tests", () => {
});
});
- test("Should have correct contentType uid", () => {
+ test('Should have correct contentType uid', () => {
const Query = Stack.ContentType(contentTypes.source).Query();
Query.includeCount()
.includeSchema()
@@ -252,7 +252,7 @@ describe("Spread Method Tests", () => {
});
});
- test("Should have count as third parameter", () => {
+ test('Should have count as third parameter', () => {
const Query = Stack.ContentType(contentTypes.source).Query();
Query.includeCount()
.includeSchema()
@@ -264,7 +264,7 @@ describe("Spread Method Tests", () => {
});
});
- test("Should maintain default sorting of descending updated_at", () => {
+ test('Should maintain default sorting of descending updated_at', () => {
const Query = Stack.ContentType(contentTypes.source).Query();
Query.includeCount()
.includeSchema()
diff --git a/test/entry/utils.js b/test/entry/utils.js
index fe9a56dd..31ef5da6 100755
--- a/test/entry/utils.js
+++ b/test/entry/utils.js
@@ -3,49 +3,49 @@
/**
* Module Dependencies.
*/
-var _ = require('lodash');
+const _ = require('lodash');
-var utils = {};
+const utils = {};
module.exports = exports = utils;
-exports.calculateBinary = function(uid) {
- var binary = 0,
- bits = uid.split('').slice(3);
- for(var i = 0, _i = bits.length; i < _i; i++) {
- binary+=parseInt(bits[i].toString(), 16);
- }
- return binary;
+exports.calculateBinary = function (uid) {
+ let binary = 0;
+ const bits = uid.split('').slice(3);
+ for (let i = 0, _i = bits.length; i < _i; i++) {
+ binary += parseInt(bits[i].toString(), 16);
+ }
+ return binary;
};
-exports.arrayPresentInArray = function(src, dest) {
- return (_.intersection(src, dest).length);
+exports.arrayPresentInArray = function (src, dest) {
+ return (_.intersection(src, dest).length);
};
exports.isEntriesPublished = function (entries, environment_uid, locale) {
- var searchInPublishDetails = function (entry) {
- var flag = false;
- if(entry && entry._metadata && entry._metadata.publish_details && entry._metadata.publish_details.length) {
- for(var i = 0, _i = entry._metadata.publish_details.length; i < _i; i++) {
- if(entry._metadata.publish_details[i] && entry._metadata.publish_details[i].environment === environment_uid && entry._metadata.publish_details[i].locale === locale) {
- if(entry._metadata.publish_details[i].scheduled && entry._metadata.publish_details[i].time) continue
- flag = true
- break
- }
- }
+ const searchInPublishDetails = function (entry) {
+ let flag = false;
+ if (entry && entry._metadata && entry._metadata.publish_details && entry._metadata.publish_details.length) {
+ for (let i = 0, _i = entry._metadata.publish_details.length; i < _i; i++) {
+ if (entry._metadata.publish_details[i] && entry._metadata.publish_details[i].environment === environment_uid && entry._metadata.publish_details[i].locale === locale) {
+ if (entry._metadata.publish_details[i].scheduled && entry._metadata.publish_details[i].time) continue;
+ flag = true;
+ break;
}
- return flag
+ }
}
+ return flag;
+ };
- var _flag = true;
- if(entries instanceof Array) {
- for(var j = 0, _j = entries.length; j < _j; j++) {
- if(typeof entries[j].toJSON === "function" && typeof entries[j].get === "function") entries[j] = entries[j].toJSON();
- _flag = searchInPublishDetails(entries[j])
- if(!_flag) break
- }
- } else if(typeof entries === "object") {
- if(typeof entries.toJSON === "function" && typeof entries.get === "function") entries = entries.toJSON();
- _flag = searchInPublishDetails(entries)
+ let _flag = true;
+ if (entries instanceof Array) {
+ for (let j = 0, _j = entries.length; j < _j; j++) {
+ if (typeof entries[j].toJSON === 'function' && typeof entries[j].get === 'function') entries[j] = entries[j].toJSON();
+ _flag = searchInPublishDetails(entries[j]);
+ if (!_flag) break;
}
- return _flag
-}
\ No newline at end of file
+ } else if (typeof entries === 'object') {
+ if (typeof entries.toJSON === 'function' && typeof entries.get === 'function') entries = entries.toJSON();
+ _flag = searchInPublishDetails(entries);
+ }
+ return _flag;
+};
diff --git a/test/index.js b/test/index.js
index 91d6debf..da0995d5 100755
--- a/test/index.js
+++ b/test/index.js
@@ -1,4 +1,4 @@
-// Entries
+// Entries
require('./entry/find');
require('./entry/find-result-wrapper');
require('./entry/findone');
@@ -14,4 +14,4 @@ require('./asset/spread');
require('./asset/image-transformation.js');
// Live-preview
-require('./live-preview/live-preview-test.js')
\ No newline at end of file
+require('./live-preview/live-preview-test.js');
diff --git a/test/live-preview/live-preview-test.js b/test/live-preview/live-preview-test.js
index 808e75d2..bf34d025 100644
--- a/test/live-preview/live-preview-test.js
+++ b/test/live-preview/live-preview-test.js
@@ -1,17 +1,16 @@
'use strict';
-const init = require("../config.js");
+const init = require('../config.js');
const Contentstack = require('../../dist/node/contentstack.js');
describe('Contentstack Live Preview Tests', () => {
test('should check for values initialized', () => {
- const stack1 = Contentstack.Stack(init.stack)
const stack = Contentstack.Stack({
- 'api_key': process.env.API_KEY,
- 'delivery_token': process.env.DELIVERY_TOKEN,
- 'environment': process.env.ENVIRONMENT
+ api_key: process.env.API_KEY,
+ delivery_token: process.env.DELIVERY_TOKEN,
+ environment: process.env.ENVIRONMENT
});
-
+
const livePreviewObject = stack.config.live_preview;
expect(livePreviewObject.enable).toBe(false);
expect(stack.config.host).toBe('cdn.contentstack.io'); // rest-preview.contentstack.com
@@ -22,7 +21,7 @@ describe('Contentstack Live Preview Tests', () => {
init.stack.live_preview.enable = true;
init.stack.live_preview.management_token = 'management_token';
const stack = Contentstack.Stack(init.stack);
-
+
const livePreviewObject = stack.config.live_preview;
expect(livePreviewObject).not.toBe('undefined');
expect(livePreviewObject.enable).not.toBe('undefined');
@@ -34,7 +33,7 @@ describe('Contentstack Live Preview Tests', () => {
init.stack.live_preview.enable = false;
init.stack.live_preview.management_token = 'management_token';
const stack = Contentstack.Stack(init.stack);
-
+
const livePreviewObject = stack.config.live_preview;
expect(livePreviewObject).not.toBe('undefined');
expect(livePreviewObject.enable).toBe(false);
@@ -45,7 +44,7 @@ describe('Contentstack Live Preview Tests', () => {
init.stack.live_preview.enable = true;
init.stack.live_preview.preview_token = 'preview_token';
const stack = Contentstack.Stack(init.stack);
-
+
const livePreviewObject = stack.config.live_preview;
expect(livePreviewObject).not.toBe('undefined');
expect(livePreviewObject.enable).not.toBe('undefined');
@@ -58,7 +57,7 @@ describe('Contentstack Live Preview Tests', () => {
init.stack.live_preview.enable = false;
init.stack.live_preview.preview_token = 'preview_token';
const stack = Contentstack.Stack(init.stack);
-
+
const livePreviewObject = stack.config.live_preview;
expect(livePreviewObject).not.toBe('undefined');
expect(livePreviewObject.enable).not.toBe('undefined');
@@ -66,4 +65,4 @@ describe('Contentstack Live Preview Tests', () => {
expect(livePreviewObject.preview_token).not.toBe('undefined');
expect(stack.config.host).toBe('cdn.contentstack.io');
});
-});
\ No newline at end of file
+});
diff --git a/test/sync/sync-testcases.js b/test/sync/sync-testcases.js
index 3655e5cd..daca4f33 100755
--- a/test/sync/sync-testcases.js
+++ b/test/sync/sync-testcases.js
@@ -1,103 +1,102 @@
-"use strict";
+'use strict';
/*
* Module Dependencies.
*/
-const Contentstack = require("../../dist/node/contentstack.js");
-const init = require("../config.js");
-
+const Contentstack = require('../../dist/node/contentstack.js');
+const init = require('../config.js');
let Stack;
-let sync_token = "";
-var pagination_token = "";
+let sync_token = '';
+let pagination_token = '';
-describe("ContentStack SDK Sync Tests", () => {
+describe('ContentStack SDK Sync Tests', () => {
// Initialize the Contentstack Stack Instance
beforeAll(() => {
return new Promise((resolve) => {
// Initialize Stack with proper configuration
- Stack = Contentstack.Stack(init.stack)
+ Stack = Contentstack.Stack(init.stack);
Stack.setHost(init.host);
setTimeout(resolve, 1000);
});
});
- describe("default .Init()", () => {
- test("should initialize sync with correct total count", async () => {
+ describe('default .Init()', () => {
+ test('should initialize sync with correct total count', async () => {
const data = await Stack.sync({ init: true });
expect(data.total_count).toBeDefined();
});
});
- describe("default .startdate()", () => {
- test("should filter entries by start date", async () => {
- const data = await Stack.sync({
- init: "true",
- start_from: "2018-10-22T00:00:00.000Z"
+ describe('default .startdate()', () => {
+ test('should filter entries by start date', async () => {
+ const data = await Stack.sync({
+ init: 'true',
+ start_from: '2018-10-22T00:00:00.000Z'
});
expect(data.total_count).toBeDefined();
});
});
- describe("default .locale()", () => {
- test("should filter entries by locale", async () => {
- const data = await Stack.sync({
- init: "true",
- locale: "en-us"
+ describe('default .locale()', () => {
+ test('should filter entries by locale', async () => {
+ const data = await Stack.sync({
+ init: 'true',
+ locale: 'en-us'
});
expect(data.total_count).toBeDefined();
});
});
- describe("default .localeDate()", () => {
- test("should filter entries by locale and date", async () => {
- const data = await Stack.sync({
- init: "true",
- locale: "en-us",
- start_from: "2018-10-22T00:00:00.000Z"
+ describe('default .localeDate()', () => {
+ test('should filter entries by locale and date', async () => {
+ const data = await Stack.sync({
+ init: 'true',
+ locale: 'en-us',
+ start_from: '2018-10-22T00:00:00.000Z'
});
expect(data.total_count).toBeDefined();
});
});
- describe("default .pagination_token()", () => {
- test("should handle pagination correctly", async () => {
+ describe('default .pagination_token()', () => {
+ test('should handle pagination correctly', async () => {
// This works only when it contains more than 100 records else sync token will be generated
- const initialData = await Stack.sync({ init: "true" });
+ const initialData = await Stack.sync({ init: 'true' });
pagination_token = initialData.pagination_token;
expect(pagination_token).toBeUndefined();
try {
await Stack.sync({ pagination_token });
} catch (error) {
- expect(error.message).toBe(`Invalid parameter value for key "pagination_token": must be a string, number, object, boolean, or RegExp.`);
+ expect(error.message).toBe('Invalid parameter value for key "pagination_token": must be a string, number, object, boolean, or RegExp.');
}
});
});
- describe("default .contentTypeUid()", () => {
- test("should filter entries by content type", async () => {
- const data = await Stack.sync({
- init: "true",
- content_type_uid: "source"
+ describe('default .contentTypeUid()', () => {
+ test('should filter entries by content type', async () => {
+ const data = await Stack.sync({
+ init: 'true',
+ content_type_uid: 'source'
});
expect(data.total_count).toBeDefined();
});
});
- describe("default .type()", () => {
- test("should filter entries by type", async () => {
- const data = await Stack.sync({
- init: "true",
- type: "asset_published"
+ describe('default .type()', () => {
+ test('should filter entries by type', async () => {
+ const data = await Stack.sync({
+ init: 'true',
+ type: 'asset_published'
});
expect(data.total_count).toBeDefined();
});
});
- describe("default .sync_token()", () => {
- test("should handle sync token correctly", async () => {
+ describe('default .sync_token()', () => {
+ test('should handle sync token correctly', async () => {
// First get a valid sync token
- const initialData = await Stack.sync({ init: "true" });
+ const initialData = await Stack.sync({ init: 'true' });
sync_token = initialData.sync_token;
const result = await Stack.sync({ sync_token });
@@ -105,4 +104,3 @@ describe("ContentStack SDK Sync Tests", () => {
});
});
});
-
diff --git a/test/sync_config.js b/test/sync_config.js
index 92aeba80..0f416f1c 100755
--- a/test/sync_config.js
+++ b/test/sync_config.js
@@ -1,29 +1,29 @@
'use strict';
module.exports = {
- stack: {
- "api_key": "",
- "delivery_token": "",
- "environment": ""
- },
- host: "",
- url: "",
- runscope: {
- url: "",
- username: "",
- password: ""
- },
- contentTypes: {
- source: "source",
- numbers_content_type: "numbers_content_type"
- },
- smtp: {
- host: 'smtp.gmail.com',
- port: 465,
- secure: true,
- auth: {
- user: '',
- pass: ''
- }
+ stack: {
+ api_key: '',
+ delivery_token: '',
+ environment: ''
+ },
+ host: '',
+ url: '',
+ runscope: {
+ url: '',
+ username: '',
+ password: ''
+ },
+ contentTypes: {
+ source: 'source',
+ numbers_content_type: 'numbers_content_type'
+ },
+ smtp: {
+ host: 'smtp.gmail.com',
+ port: 465,
+ secure: true,
+ auth: {
+ user: '',
+ pass: ''
}
-}
\ No newline at end of file
+ }
+};