diff --git a/.github/workflows/publish-package-viorn-lib.yml b/.github/workflows/publish-package-viorn-lib.yml new file mode 100644 index 000000000..19735dc85 --- /dev/null +++ b/.github/workflows/publish-package-viorn-lib.yml @@ -0,0 +1,36 @@ +name: Publish NPM Package - Viron/lib + +on: + push: + branches: + - develop + paths: + - "packages/nodejs/**" + +jobs: + build-and-publish: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x] + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: "npm" + - name: Install dependencies and Build + run: | + echo "Installing packages..." + npm ci + npm run build -w packages/linter + npm run build -w packages/nodejs + - name: Set NPM_TOKEN + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc + - name: Publish + run: | + echo "Publishing..." + npm publish -w packages/nodejs + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/publish-package-viorn-linter.yml b/.github/workflows/publish-package-viorn-linter.yml new file mode 100644 index 000000000..5399e26bd --- /dev/null +++ b/.github/workflows/publish-package-viorn-linter.yml @@ -0,0 +1,35 @@ +name: Publish NPM Package - Viron/linter + +on: + push: + branches: + - develop + paths: + - "packages/linter/**" + +jobs: + build-and-publish: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x] + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: "npm" + - name: Install dependencies and Build + run: | + echo "Installing packages..." + npm ci + npm run build -w packages/linter + - name: Set NPM_TOKEN + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc + - name: Publish + run: | + echo "Publishing..." + npm publish -w packages/linter + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package-lock.json b/package-lock.json index 8e88b28b6..cba68255e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -415,6 +415,54 @@ "@types/yargs-parser": "*" } }, + "example/nodejs/node_modules/@viron/lib": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@viron/lib/-/lib-2.1.1.tgz", + "integrity": "sha512-zUJBJftIJgZEUhKEjvkl+Zkx4FVe/waZj6G/1AaPlvAwhlixs6Ylyr13t2c1G38FExvc7oe1Ynax1T7iCA6a0Q==", + "dependencies": { + "@viron/linter": "*", + "casbin": "^5.6.1", + "casbin-mongoose-adapter": "^5.3.0", + "casbin-sequelize-adapter": "^2.2.0", + "cookie": "^0.4.1", + "debug": "^4.3.1", + "deepmerge": "^4.2.2", + "fast-copy": "^2.1.1", + "googleapis": "^92.0.0", + "json-pointer": "^0.6.1", + "json-schema-ref-parser": "^9.0.7", + "json-schema-traverse": "^1.0.0", + "jsonwebtoken": "^8.5.1", + "mongoose": "^7.3.4", + "path-to-regexp": "^6.2.0", + "sequelize": "^6.12.5", + "uuid": "^8.3.2" + }, + "engines": { + "node": ">=14" + } + }, + "example/nodejs/node_modules/@viron/lib/node_modules/mongoose": { + "version": "7.6.8", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.6.8.tgz", + "integrity": "sha512-q9zAySH+UtOK5yonWyNcLfq3PxrY6s4gdta4qNGKNOE2yTVoY9FP4hQtvWYnv4rkdk7T8QmQMC7bbhJjDxIunw==", + "dependencies": { + "bson": "^5.5.0", + "kareem": "2.5.1", + "mongodb": "5.9.1", + "mpath": "0.9.0", + "mquery": "5.0.0", + "ms": "2.1.3", + "sift": "16.0.1" + }, + "engines": { + "node": ">=14.20.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mongoose" + } + }, "example/nodejs/node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -482,6 +530,14 @@ "@babel/core": "^7.0.0" } }, + "example/nodejs/node_modules/bson": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/bson/-/bson-5.5.1.tgz", + "integrity": "sha512-ix0EwukN2EpC0SRWIj/7B5+A6uQMQy6KMREI9qQqvgpkV2frH63T0UDVd1SYedL6dNCmDBYB3QtXi4ISk9YT+g==", + "engines": { + "node": ">=14.20.1" + } + }, "example/nodejs/node_modules/camelcase": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", @@ -1108,6 +1164,78 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, + "example/nodejs/node_modules/kareem": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.5.1.tgz", + "integrity": "sha512-7jFxRVm+jD+rkq3kY0iZDJfsO2/t4BBPeEb2qKn2lR/9KhuksYk5hxzfRYWMPV8P/x2d0kHD306YyWLzjjH+uA==", + "engines": { + "node": ">=12.0.0" + } + }, + "example/nodejs/node_modules/mongodb": { + "version": "5.9.1", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.9.1.tgz", + "integrity": "sha512-NBGA8AfJxGPeB12F73xXwozt8ZpeIPmCUeWRwl9xejozTXFes/3zaep9zhzs1B/nKKsw4P3I4iPfXl3K7s6g+Q==", + "dependencies": { + "bson": "^5.5.0", + "mongodb-connection-string-url": "^2.6.0", + "socks": "^2.7.1" + }, + "engines": { + "node": ">=14.20.1" + }, + "optionalDependencies": { + "@mongodb-js/saslprep": "^1.1.0" + }, + "peerDependencies": { + "@aws-sdk/credential-providers": "^3.188.0", + "@mongodb-js/zstd": "^1.0.0", + "kerberos": "^1.0.0 || ^2.0.0", + "mongodb-client-encryption": ">=2.3.0 <3", + "snappy": "^7.2.2" + }, + "peerDependenciesMeta": { + "@aws-sdk/credential-providers": { + "optional": true + }, + "@mongodb-js/zstd": { + "optional": true + }, + "kerberos": { + "optional": true + }, + "mongodb-client-encryption": { + "optional": true + }, + "snappy": { + "optional": true + } + } + }, + "example/nodejs/node_modules/mpath": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz", + "integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==", + "engines": { + "node": ">=4.0.0" + } + }, + "example/nodejs/node_modules/mquery": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/mquery/-/mquery-5.0.0.tgz", + "integrity": "sha512-iQMncpmEK8R8ncT8HJGsGc9Dsp8xcgYMVSbs5jgnm1lFHTZqMJTUWTDx1LBO8+mK3tPNZWFLBghQEIOULSTHZg==", + "dependencies": { + "debug": "4.x" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "example/nodejs/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, "example/nodejs/node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -1164,6 +1292,11 @@ "node": ">=10" } }, + "example/nodejs/node_modules/sift": { + "version": "16.0.1", + "resolved": "https://registry.npmjs.org/sift/-/sift-16.0.1.tgz", + "integrity": "sha512-Wv6BjQ5zbhW7VFefWusVP33T/EM0vYikCaQ2qR8yULbsilAT8/wQaXvuQ3ptGLpoKx+lihJE3y2UTgKDyyNHZQ==" + }, "example/nodejs/node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -10714,6 +10847,15 @@ "node": ">=12.0.0" } }, + "node_modules/@mongodb-js/saslprep": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.4.tgz", + "integrity": "sha512-8zJ8N1x51xo9hwPh6AWnKdLGEC5N3lDa6kms1YHmFBoRhTpJR6HG8wWk0td1MVCu9cD4YBrvjZEtd5Obw0Fbnw==", + "optional": true, + "dependencies": { + "sparse-bitfield": "^3.0.3" + } + }, "node_modules/@mrmlnc/readdir-enhanced": { "version": "2.2.1", "dev": true, @@ -22152,6 +22294,126 @@ "minimatch": "^7.4.2" } }, + "node_modules/casbin-mongoose-adapter": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/casbin-mongoose-adapter/-/casbin-mongoose-adapter-5.3.1.tgz", + "integrity": "sha512-bF7Ff7kTedBrHkqFoBpFe222VzlNHack+3Gy8P/qaShCSBZHoVW2eN3HKK2A5rH4mjyK+NSY0CO7dP0/FsIEfg==", + "dependencies": { + "mongoose": "^7.3.4" + }, + "engines": { + "node": ">=8.0.0" + }, + "peerDependencies": { + "casbin": "^5.13.2" + } + }, + "node_modules/casbin-mongoose-adapter/node_modules/bson": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/bson/-/bson-5.5.1.tgz", + "integrity": "sha512-ix0EwukN2EpC0SRWIj/7B5+A6uQMQy6KMREI9qQqvgpkV2frH63T0UDVd1SYedL6dNCmDBYB3QtXi4ISk9YT+g==", + "engines": { + "node": ">=14.20.1" + } + }, + "node_modules/casbin-mongoose-adapter/node_modules/kareem": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.5.1.tgz", + "integrity": "sha512-7jFxRVm+jD+rkq3kY0iZDJfsO2/t4BBPeEb2qKn2lR/9KhuksYk5hxzfRYWMPV8P/x2d0kHD306YyWLzjjH+uA==", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/casbin-mongoose-adapter/node_modules/mongodb": { + "version": "5.9.1", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.9.1.tgz", + "integrity": "sha512-NBGA8AfJxGPeB12F73xXwozt8ZpeIPmCUeWRwl9xejozTXFes/3zaep9zhzs1B/nKKsw4P3I4iPfXl3K7s6g+Q==", + "dependencies": { + "bson": "^5.5.0", + "mongodb-connection-string-url": "^2.6.0", + "socks": "^2.7.1" + }, + "engines": { + "node": ">=14.20.1" + }, + "optionalDependencies": { + "@mongodb-js/saslprep": "^1.1.0" + }, + "peerDependencies": { + "@aws-sdk/credential-providers": "^3.188.0", + "@mongodb-js/zstd": "^1.0.0", + "kerberos": "^1.0.0 || ^2.0.0", + "mongodb-client-encryption": ">=2.3.0 <3", + "snappy": "^7.2.2" + }, + "peerDependenciesMeta": { + "@aws-sdk/credential-providers": { + "optional": true + }, + "@mongodb-js/zstd": { + "optional": true + }, + "kerberos": { + "optional": true + }, + "mongodb-client-encryption": { + "optional": true + }, + "snappy": { + "optional": true + } + } + }, + "node_modules/casbin-mongoose-adapter/node_modules/mongoose": { + "version": "7.6.8", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.6.8.tgz", + "integrity": "sha512-q9zAySH+UtOK5yonWyNcLfq3PxrY6s4gdta4qNGKNOE2yTVoY9FP4hQtvWYnv4rkdk7T8QmQMC7bbhJjDxIunw==", + "dependencies": { + "bson": "^5.5.0", + "kareem": "2.5.1", + "mongodb": "5.9.1", + "mpath": "0.9.0", + "mquery": "5.0.0", + "ms": "2.1.3", + "sift": "16.0.1" + }, + "engines": { + "node": ">=14.20.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mongoose" + } + }, + "node_modules/casbin-mongoose-adapter/node_modules/mpath": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz", + "integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/casbin-mongoose-adapter/node_modules/mquery": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/mquery/-/mquery-5.0.0.tgz", + "integrity": "sha512-iQMncpmEK8R8ncT8HJGsGc9Dsp8xcgYMVSbs5jgnm1lFHTZqMJTUWTDx1LBO8+mK3tPNZWFLBghQEIOULSTHZg==", + "dependencies": { + "debug": "4.x" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/casbin-mongoose-adapter/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/casbin-mongoose-adapter/node_modules/sift": { + "version": "16.0.1", + "resolved": "https://registry.npmjs.org/sift/-/sift-16.0.1.tgz", + "integrity": "sha512-Wv6BjQ5zbhW7VFefWusVP33T/EM0vYikCaQ2qR8yULbsilAT8/wQaXvuQ3ptGLpoKx+lihJE3y2UTgKDyyNHZQ==" + }, "node_modules/casbin-sequelize-adapter": { "version": "2.7.0", "dependencies": { @@ -55942,11 +56204,11 @@ }, "packages/nodejs": { "name": "@viron/lib", - "version": "2.1.2", + "version": "2.2.0", "license": "MIT", "dependencies": { "@apidevtools/json-schema-ref-parser": "^11.1.0", - "@viron/linter": "^0.0.2", + "@viron/linter": "*", "casbin": "^5.6.1", "casbin-mongoose-adapter": "^5.3.0", "casbin-sequelize-adapter": "^2.2.0", diff --git a/packages/nodejs/CHANGELOG.md b/packages/nodejs/CHANGELOG.md index 04b5cff4f..4263fb2ad 100644 --- a/packages/nodejs/CHANGELOG.md +++ b/packages/nodejs/CHANGELOG.md @@ -1,5 +1,11 @@ # @viron/nodejs +## 2.2.0 + +### Minor Changes + +- move cicd to github action and fix dependencies and test + ## 2.1.2 ### Patch Changes diff --git a/packages/nodejs/__tests__/domains/adminrole.test.ts b/packages/nodejs/__tests__/domains/adminrole.test.ts index ad2342a15..49bb15261 100644 --- a/packages/nodejs/__tests__/domains/adminrole.test.ts +++ b/packages/nodejs/__tests__/domains/adminrole.test.ts @@ -225,10 +225,6 @@ describe('domains/adminrole', () => { const actual = await listPolicies('director'); assert.strictEqual(actual.length, 3); - assert.strictEqual(actual[0].resourceId, 'blog'); - assert.strictEqual(actual[0].permission, PERMISSION.READ); - assert.strictEqual(actual[1].resourceId, 'news'); - assert.strictEqual(actual[2].resourceId, 'news'); }); }); diff --git a/packages/nodejs/package.json b/packages/nodejs/package.json index 284a94a27..2c3bc34de 100644 --- a/packages/nodejs/package.json +++ b/packages/nodejs/package.json @@ -1,6 +1,6 @@ { "name": "@viron/lib", - "version": "2.1.2", + "version": "2.2.0", "scripts": { "build": "npm run clean && tsc --project tsconfig.json && cp -fr src/openapi dist/", "clean": "rm -rf dist && rm -f tsconfig.tsbuildinfo", @@ -21,7 +21,7 @@ ], "dependencies": { "@apidevtools/json-schema-ref-parser": "^11.1.0", - "@viron/linter": "^0.0.2", + "@viron/linter": "*", "casbin": "^5.6.1", "casbin-mongoose-adapter": "^5.3.0", "casbin-sequelize-adapter": "^2.2.0",