@boxyhq/saml-jackson 0.2.4-beta.198 → 0.3.0-beta.248

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. package/Dockerfile +9 -7
  2. package/README.md +28 -29
  3. package/dist/controller/api.d.ts +32 -0
  4. package/dist/controller/api.js +193 -0
  5. package/dist/controller/error.d.ts +5 -0
  6. package/dist/controller/error.js +12 -0
  7. package/dist/controller/oauth/allowed.d.ts +1 -0
  8. package/dist/controller/oauth/allowed.js +17 -0
  9. package/dist/controller/oauth/code-verifier.d.ts +2 -0
  10. package/dist/controller/oauth/code-verifier.js +15 -0
  11. package/dist/controller/oauth/redirect.d.ts +1 -0
  12. package/dist/controller/oauth/redirect.js +11 -0
  13. package/dist/controller/oauth.d.ts +23 -0
  14. package/dist/controller/oauth.js +263 -0
  15. package/dist/controller/utils.d.ts +6 -0
  16. package/dist/controller/utils.js +17 -0
  17. package/dist/db/db.d.ts +15 -0
  18. package/dist/db/db.js +107 -0
  19. package/dist/db/encrypter.d.ts +3 -0
  20. package/dist/db/encrypter.js +29 -0
  21. package/dist/db/mem.d.ts +20 -0
  22. package/dist/db/mem.js +128 -0
  23. package/dist/db/mongo.d.ts +17 -0
  24. package/dist/db/mongo.js +106 -0
  25. package/dist/db/redis.d.ts +15 -0
  26. package/dist/db/redis.js +107 -0
  27. package/dist/db/sql/entity/JacksonIndex.d.ts +7 -0
  28. package/dist/db/sql/entity/JacksonIndex.js +41 -0
  29. package/dist/db/sql/entity/JacksonStore.d.ts +6 -0
  30. package/dist/db/sql/entity/JacksonStore.js +42 -0
  31. package/dist/db/sql/entity/JacksonTTL.d.ts +4 -0
  32. package/dist/db/sql/entity/JacksonTTL.js +29 -0
  33. package/dist/db/sql/sql.d.ts +20 -0
  34. package/dist/db/sql/sql.js +174 -0
  35. package/dist/db/store.d.ts +5 -0
  36. package/dist/db/store.js +68 -0
  37. package/dist/db/utils.d.ts +7 -0
  38. package/dist/db/utils.js +29 -0
  39. package/dist/env.d.ts +22 -0
  40. package/dist/env.js +35 -0
  41. package/dist/index.d.ts +9 -0
  42. package/dist/index.js +82 -0
  43. package/dist/jackson.d.ts +1 -0
  44. package/dist/jackson.js +153 -0
  45. package/dist/read-config.d.ts +3 -0
  46. package/dist/read-config.js +50 -0
  47. package/dist/saml/claims.d.ts +6 -0
  48. package/dist/saml/claims.js +35 -0
  49. package/dist/saml/saml.d.ts +11 -0
  50. package/dist/saml/saml.js +200 -0
  51. package/dist/saml/x509.d.ts +7 -0
  52. package/dist/saml/x509.js +69 -0
  53. package/dist/typings.d.ts +137 -0
  54. package/dist/typings.js +2 -0
  55. package/package.json +41 -21
  56. package/.dockerignore +0 -2
  57. package/.eslintrc.js +0 -13
  58. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -27
  59. package/.github/ISSUE_TEMPLATE/config.yml +0 -5
  60. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -43
  61. package/.github/pull_request_template.md +0 -31
  62. package/.github/workflows/codesee-arch-diagram.yml +0 -81
  63. package/.github/workflows/main.yml +0 -123
  64. package/_dev/docker-compose.yml +0 -37
  65. package/map.js +0 -1
  66. package/prettier.config.js +0 -4
  67. package/src/controller/api.js +0 -167
  68. package/src/controller/error.js +0 -12
  69. package/src/controller/oauth/allowed.js +0 -19
  70. package/src/controller/oauth/code-verifier.js +0 -16
  71. package/src/controller/oauth/redirect.js +0 -18
  72. package/src/controller/oauth.js +0 -321
  73. package/src/controller/utils.js +0 -19
  74. package/src/db/db.js +0 -81
  75. package/src/db/db.test.js +0 -302
  76. package/src/db/encrypter.js +0 -36
  77. package/src/db/mem.js +0 -111
  78. package/src/db/mongo.js +0 -89
  79. package/src/db/redis.js +0 -88
  80. package/src/db/sql/entity/JacksonIndex.js +0 -42
  81. package/src/db/sql/entity/JacksonStore.js +0 -42
  82. package/src/db/sql/entity/JacksonTTL.js +0 -23
  83. package/src/db/sql/model/JacksonIndex.js +0 -9
  84. package/src/db/sql/model/JacksonStore.js +0 -10
  85. package/src/db/sql/model/JacksonTTL.js +0 -8
  86. package/src/db/sql/sql.js +0 -153
  87. package/src/db/store.js +0 -42
  88. package/src/db/utils.js +0 -30
  89. package/src/env.js +0 -39
  90. package/src/index.js +0 -67
  91. package/src/jackson.js +0 -161
  92. package/src/read-config.js +0 -24
  93. package/src/saml/claims.js +0 -40
  94. package/src/saml/saml.js +0 -223
  95. package/src/saml/x509.js +0 -48
  96. package/src/test/api.test.js +0 -186
  97. package/src/test/data/metadata/boxyhq.js +0 -6
  98. package/src/test/data/metadata/boxyhq.xml +0 -30
  99. package/src/test/data/saml_response +0 -1
  100. package/src/test/oauth.test.js +0 -342
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
+ return new (P || (P = Promise))(function (resolve, reject) {
24
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ };
30
+ Object.defineProperty(exports, "__esModule", { value: true });
31
+ const x509 = __importStar(require("@peculiar/x509"));
32
+ const webcrypto_1 = require("@peculiar/webcrypto");
33
+ const crypto = new webcrypto_1.Crypto();
34
+ x509.cryptoProvider.set(crypto);
35
+ const alg = {
36
+ name: 'RSASSA-PKCS1-v1_5',
37
+ hash: 'SHA-256',
38
+ publicExponent: new Uint8Array([1, 0, 1]),
39
+ modulusLength: 2048,
40
+ };
41
+ const generate = () => __awaiter(void 0, void 0, void 0, function* () {
42
+ const keys = yield crypto.subtle.generateKey(alg, true, ['sign', 'verify']);
43
+ const extensions = [
44
+ new x509.BasicConstraintsExtension(false, undefined, true),
45
+ ];
46
+ extensions.push(new x509.KeyUsagesExtension(x509.KeyUsageFlags.digitalSignature, true));
47
+ if (keys.publicKey) {
48
+ extensions.push(yield x509.SubjectKeyIdentifierExtension.create(keys.publicKey));
49
+ }
50
+ const cert = yield x509.X509CertificateGenerator.createSelfSigned({
51
+ serialNumber: '01',
52
+ name: 'CN=BoxyHQ Jackson',
53
+ notBefore: new Date(),
54
+ notAfter: new Date('3021/01/01'),
55
+ signingAlgorithm: alg,
56
+ keys: keys,
57
+ extensions,
58
+ });
59
+ if (keys.privateKey) {
60
+ const pkcs8 = yield crypto.subtle.exportKey('pkcs8', keys.privateKey);
61
+ return {
62
+ publicKey: cert.toString('pem'),
63
+ privateKey: x509.PemConverter.encode(pkcs8, 'private key'),
64
+ };
65
+ }
66
+ });
67
+ exports.default = {
68
+ generate,
69
+ };
@@ -0,0 +1,137 @@
1
+ export declare type IdPConfig = {
2
+ defaultRedirectUrl: string;
3
+ redirectUrl: string;
4
+ tenant: string;
5
+ product: string;
6
+ rawMetadata: string;
7
+ };
8
+ export interface OAuth {
9
+ client_id: string;
10
+ client_secret: string;
11
+ provider: string;
12
+ }
13
+ export interface ISAMLConfig {
14
+ config(body: IdPConfig): Promise<OAuth>;
15
+ getConfig(body: {
16
+ clientID: string;
17
+ tenant: string;
18
+ product: string;
19
+ }): Promise<Partial<OAuth>>;
20
+ deleteConfig(body: {
21
+ clientID: string;
22
+ clientSecret: string;
23
+ tenant: string;
24
+ product: string;
25
+ }): Promise<void>;
26
+ create(body: IdPConfig): Promise<OAuth>;
27
+ get(body: {
28
+ clientID: string;
29
+ tenant: string;
30
+ product: string;
31
+ }): Promise<Partial<OAuth>>;
32
+ delete(body: {
33
+ clientID: string;
34
+ clientSecret: string;
35
+ tenant: string;
36
+ product: string;
37
+ }): Promise<void>;
38
+ }
39
+ export interface IOAuthController {
40
+ authorize(body: OAuthReqBody): Promise<{
41
+ redirect_url: string;
42
+ }>;
43
+ samlResponse(body: SAMLResponsePayload): Promise<{
44
+ redirect_url: string;
45
+ }>;
46
+ token(body: OAuthTokenReq): Promise<OAuthTokenRes>;
47
+ userInfo(token: string): Promise<Profile>;
48
+ }
49
+ export interface OAuthReqBody {
50
+ response_type: 'code';
51
+ client_id: string;
52
+ redirect_uri: string;
53
+ state: string;
54
+ tenant: string;
55
+ product: string;
56
+ code_challenge: string;
57
+ code_challenge_method: 'plain' | 'S256' | '';
58
+ provider: 'saml';
59
+ }
60
+ export interface SAMLResponsePayload {
61
+ SAMLResponse: string;
62
+ RelayState: string;
63
+ }
64
+ export interface OAuthTokenReq {
65
+ client_id: string;
66
+ client_secret: string;
67
+ code_verifier: string;
68
+ code: string;
69
+ grant_type: 'authorization_code';
70
+ }
71
+ export interface OAuthTokenRes {
72
+ access_token: string;
73
+ token_type: 'bearer';
74
+ expires_in: number;
75
+ }
76
+ export interface Profile {
77
+ id: string;
78
+ email: string;
79
+ firstName: string;
80
+ lastName: string;
81
+ }
82
+ export interface Index {
83
+ name: string;
84
+ value: string;
85
+ }
86
+ export interface DatabaseDriver {
87
+ get(namespace: string, key: string): Promise<any>;
88
+ put(namespace: string, key: string, val: any, ttl: number, ...indexes: Index[]): Promise<any>;
89
+ delete(namespace: string, key: string): Promise<any>;
90
+ getByIndex(namespace: string, idx: Index): Promise<any>;
91
+ }
92
+ export interface Storable {
93
+ get(key: string): Promise<any>;
94
+ put(key: string, val: any, ...indexes: Index[]): Promise<any>;
95
+ delete(key: string): Promise<any>;
96
+ getByIndex(idx: Index): Promise<any>;
97
+ }
98
+ export interface Encrypted {
99
+ iv?: string;
100
+ tag?: string;
101
+ value: string;
102
+ }
103
+ export declare type EncryptionKey = any;
104
+ export declare type DatabaseEngine = 'redis' | 'sql' | 'mongo' | 'mem';
105
+ export declare type DatabaseType = 'postgres' | 'mysql' | 'mariadb';
106
+ export interface DatabaseOption {
107
+ engine: DatabaseEngine;
108
+ url: string;
109
+ type: DatabaseType;
110
+ ttl: number;
111
+ cleanupLimit: number;
112
+ encryptionKey: string;
113
+ }
114
+ export interface SAMLReq {
115
+ ssoUrl?: string;
116
+ entityID: string;
117
+ callbackUrl: string;
118
+ isPassive?: boolean;
119
+ forceAuthn?: boolean;
120
+ identifierFormat?: 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress';
121
+ providerName?: 'BoxyHQ';
122
+ signingKey: string;
123
+ }
124
+ export interface SAMLProfile {
125
+ audience: string;
126
+ claims: Record<string, any>;
127
+ issuer: string;
128
+ sessionIndex: string;
129
+ }
130
+ export interface JacksonOption {
131
+ externalUrl: string;
132
+ samlPath: string;
133
+ samlAudience: string;
134
+ preLoadedConfig?: string;
135
+ idpEnabled?: boolean;
136
+ db: DatabaseOption;
137
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@boxyhq/saml-jackson",
3
- "version": "0.2.4-beta.198",
3
+ "version": "0.3.0-beta.248",
4
4
  "license": "Apache 2.0",
5
5
  "description": "SAML 2.0 service",
6
- "main": "src/index.js",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
7
8
  "engines": {
8
- "node": ">=14.x"
9
+ "node": ">=14.18.1"
9
10
  },
10
11
  "repository": {
11
12
  "type": "git",
@@ -15,14 +16,18 @@
15
16
  "SAML 2.0"
16
17
  ],
17
18
  "scripts": {
18
- "start": "cross-env IDP_ENABLED=true node src/jackson.js",
19
- "dev": "cross-env IDP_ENABLED=true nodemon src/jackson.js",
20
- "mongo": "cross-env JACKSON_API_KEYS=secret DB_ENGINE=mongo DB_URL=mongodb://localhost:27017/jackson nodemon src/jackson.js",
21
- "pre-loaded": "cross-env JACKSON_API_KEYS=secret DB_ENGINE=mem PRE_LOADED_CONFIG='./_config' nodemon src/jackson.js",
22
- "pre-loaded-db": "cross-env JACKSON_API_KEYS=secret PRE_LOADED_CONFIG='./_config' nodemon src/jackson.js",
23
- "test": "tap --timeout=100 src/**/*.test.js",
19
+ "build": "tsc -p tsconfig.build.json",
20
+ "prepublishOnly": "npm run build",
21
+ "start": "cross-env IDP_ENABLED=true node dist/jackson.js",
22
+ "dev": "cross-env IDP_ENABLED=true nodemon --config nodemon.json src/jackson.ts",
23
+ "mongo": "cross-env JACKSON_API_KEYS=secret DB_ENGINE=mongo DB_URL=mongodb://localhost:27017/jackson nodemon --config nodemon.json src/jackson.ts",
24
+ "sql": "cross-env JACKSON_API_KEYS=secret DB_ENGINE=sql DB_TYPE=postgres DB_URL=postgres://postgres:postgres@localhost:5432/jackson nodemon --config nodemon.json src/jackson.ts",
25
+ "pre-loaded": "cross-env JACKSON_API_KEYS=secret DB_ENGINE=mem PRE_LOADED_CONFIG='./_config' nodemon --config nodemon.json src/jackson.ts",
26
+ "pre-loaded-db": "cross-env JACKSON_API_KEYS=secret PRE_LOADED_CONFIG='./_config' nodemon --config nodemon.json src/jackson.ts",
27
+ "test": "tap --ts --timeout=100 --coverage src/**/*.test.ts ",
24
28
  "dev-dbs": "docker-compose -f ./_dev/docker-compose.yml up -d",
25
- "dev-dbs-destroy": "docker-compose -f ./_dev/docker-compose.yml down --volumes --remove-orphans"
29
+ "dev-dbs-destroy": "docker-compose -f ./_dev/docker-compose.yml down --volumes --remove-orphans",
30
+ "db:migration:generate": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:generate --config ormconfig.js -n Initial"
26
31
  },
27
32
  "tap": {
28
33
  "coverage-map": "map.js",
@@ -33,15 +38,15 @@
33
38
  },
34
39
  "dependencies": {
35
40
  "@boxyhq/saml20": "0.2.0",
36
- "@peculiar/webcrypto": "1.2.2",
37
- "@peculiar/x509": "1.6.0",
41
+ "@peculiar/webcrypto": "1.2.3",
42
+ "@peculiar/x509": "1.6.1",
38
43
  "cors": "2.8.5",
39
- "express": "4.17.1",
40
- "mongodb": "4.2.1",
44
+ "express": "4.17.2",
45
+ "mongodb": "4.2.2",
41
46
  "mysql2": "2.3.3",
42
47
  "pg": "8.7.1",
43
48
  "rambda": "6.9.0",
44
- "redis": "4.0.0-rc.4",
49
+ "redis": "4.0.1",
45
50
  "reflect-metadata": "0.1.13",
46
51
  "ripemd160": "2.0.2",
47
52
  "thumbprint": "0.0.1",
@@ -51,17 +56,32 @@
51
56
  "xmlbuilder": "15.1.1"
52
57
  },
53
58
  "devDependencies": {
59
+ "@types/express": "^4.17.13",
60
+ "@types/node": "^16.11.17",
61
+ "@types/redis": "4.0.11",
62
+ "@types/sinon": "10.0.6",
63
+ "@types/tap": "15.0.5",
64
+ "@typescript-eslint/eslint-plugin": "^5.8.1",
65
+ "@typescript-eslint/parser": "^5.8.1",
54
66
  "cross-env": "7.0.3",
55
- "eslint": "8.4.0",
67
+ "eslint": "^8.5.0",
68
+ "eslint-config-prettier": "^8.3.0",
56
69
  "husky": "7.0.4",
57
- "lint-staged": "12.1.2",
70
+ "lint-staged": "12.1.4",
58
71
  "nodemon": "2.0.15",
59
72
  "prettier": "2.5.1",
60
73
  "sinon": "12.0.1",
61
- "tap": "15.1.5"
74
+ "tap": "15.1.5",
75
+ "ts-node": "10.4.0",
76
+ "tsconfig-paths": "3.12.0",
77
+ "typescript": "4.5.4"
62
78
  },
63
79
  "lint-staged": {
64
- "*.js": "eslint --cache --fix",
65
- "*.{js,css,md}": "prettier --write"
66
- }
80
+ "*.{js,ts}": "eslint --cache --fix",
81
+ "*.{js,ts,css,md}": "prettier --write"
82
+ },
83
+ "files": [
84
+ "dist",
85
+ "Dockerfile"
86
+ ]
67
87
  }
package/.dockerignore DELETED
@@ -1,2 +0,0 @@
1
- node_modules
2
- npm-debug.log
package/.eslintrc.js DELETED
@@ -1,13 +0,0 @@
1
- module.exports = {
2
- "env": {
3
- "es2021": true,
4
- "node": true
5
- },
6
- "extends": "eslint:recommended",
7
- "parserOptions": {
8
- "ecmaVersion": 13,
9
- "sourceType": "module"
10
- },
11
- "rules": {
12
- }
13
- };
@@ -1,27 +0,0 @@
1
- ---
2
- name: Bug report
3
- about: Report any issues with the platform
4
- title: ""
5
- labels: bug
6
- assignees: ""
7
- ---
8
-
9
- Found a bug? Please fill out the sections below. 👍
10
-
11
- ### Issue Summary
12
-
13
- A summary of the issue. This needs to be a clear detailed-rich summary.
14
-
15
- ### Steps to Reproduce
16
-
17
- 1. (for example) Went to ...
18
- 2. Clicked on...
19
- 3. ...
20
-
21
- Any other relevant information. For example, why do you consider this a bug and what did you expect to happen instead?
22
-
23
- ### Technical details
24
-
25
- - Browser version: You can use https://www.whatsmybrowser.org/ to find this out.
26
- - Node.js version
27
- - Anything else that you think could be an issue.
@@ -1,5 +0,0 @@
1
- blank_issues_enabled: false
2
- contact_links:
3
- - name: Questions
4
- url: https://github.com/boxyhq/jackson/discussions
5
- about: Ask a general question about the project on our GitHub Discussion page
@@ -1,43 +0,0 @@
1
- ---
2
- name: Feature request
3
- about: Suggest a feature or idea
4
- title: ""
5
- labels: enhancement
6
- assignees: ""
7
- ---
8
-
9
- > Please check if your Feature Request has not been already raised in the [Discussions Tab](https://github.com/boxyhq/jackson/discussions), as we would like to reduce duplicates. If it has been already raised, simply upvote it 🔼.
10
-
11
- ### Is your proposal related to a problem?
12
-
13
- <!--
14
- Provide a clear and concise description of what the problem is.
15
- For example, "I'm always frustrated when..."
16
- -->
17
-
18
- (Write your answer here.)
19
-
20
- ### Describe the solution you'd like
21
-
22
- <!--
23
- Provide a clear and concise description of what you want to happen.
24
- -->
25
-
26
- (Describe your proposed solution here.)
27
-
28
- ### Describe alternatives you've considered
29
-
30
- <!--
31
- Let us know about other solutions you've tried or researched.
32
- -->
33
-
34
- (Write your answer here.)
35
-
36
- ### Additional context
37
-
38
- <!--
39
- Is there anything else you can add about the proposal?
40
- You might want to link to related issues here, if you haven't already.
41
- -->
42
-
43
- (Write your answer here.)
@@ -1,31 +0,0 @@
1
- ## What does this PR do?
2
-
3
- <!-- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. -->
4
-
5
- Fixes # (issue)
6
-
7
- ## Type of change
8
-
9
- <!-- Please delete options that are not relevant. -->
10
-
11
- - [ ] Bug fix (non-breaking change which fixes an issue)
12
- - [ ] New feature (non-breaking change which adds functionality)
13
- - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
14
- - [ ] This change requires a documentation update
15
-
16
- ## How should this be tested?
17
-
18
- <!-- Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration -->
19
-
20
- - [ ] Test A
21
- - [ ] Test B
22
-
23
- ## Checklist:
24
-
25
- - [ ] My code follows the style guidelines of this project
26
- - [ ] I have performed a self-review of my own code and corrected any misspellings
27
- - [ ] I have commented my code, particularly in hard-to-understand areas
28
- - [ ] I have made corresponding changes to the documentation
29
- - [ ] My changes generate no new warnings
30
- - [ ] I have added tests that prove my fix is effective or that my feature works
31
- - [ ] New and existing unit tests pass locally with my changes
@@ -1,81 +0,0 @@
1
- on:
2
- push:
3
- branches:
4
- - main
5
- pull_request_target:
6
- types: [opened, synchronize, reopened]
7
-
8
- name: CodeSee Map
9
-
10
- jobs:
11
- test_map_action:
12
- runs-on: ubuntu-latest
13
- continue-on-error: true
14
- name: Run CodeSee Map Analysis
15
- steps:
16
- - name: checkout
17
- id: checkout
18
- uses: actions/checkout@v2
19
- with:
20
- repository: ${{ github.event.pull_request.head.repo.full_name }}
21
- ref: ${{ github.event.pull_request.head.ref }}
22
- fetch-depth: 0
23
-
24
- # codesee-detect-languages has an output with id languages.
25
- - name: Detect Languages
26
- id: detect-languages
27
- uses: Codesee-io/codesee-detect-languages-action@latest
28
-
29
- - name: Configure JDK 16
30
- uses: actions/setup-java@v2
31
- if: ${{ fromJSON(steps.detect-languages.outputs.languages).java }}
32
- with:
33
- java-version: '16'
34
- distribution: 'zulu'
35
-
36
- # CodeSee Maps Go support uses a static binary so there's no setup step required.
37
-
38
- - name: Configure Node.js 14
39
- uses: actions/setup-node@v2
40
- if: ${{ fromJSON(steps.detect-languages.outputs.languages).javascript }}
41
- with:
42
- node-version: '14'
43
-
44
- - name: Configure Python 3.x
45
- uses: actions/setup-python@v2
46
- if: ${{ fromJSON(steps.detect-languages.outputs.languages).python }}
47
- with:
48
- python-version: '3.x'
49
- architecture: 'x64'
50
-
51
- - name: Configure Ruby '3.x'
52
- uses: ruby/setup-ruby@v1
53
- if: ${{ fromJSON(steps.detect-languages.outputs.languages).ruby }}
54
- with:
55
- ruby-version: '3.0'
56
-
57
- # CodeSee Maps Rust support uses a static binary so there's no setup step required.
58
-
59
- - name: Generate Map
60
- id: generate-map
61
- uses: Codesee-io/codesee-map-action@latest
62
- with:
63
- step: map
64
- github_ref: ${{ github.ref }}
65
- languages: ${{ steps.detect-languages.outputs.languages }}
66
-
67
- - name: Upload Map
68
- id: upload-map
69
- uses: Codesee-io/codesee-map-action@latest
70
- with:
71
- step: mapUpload
72
- api_token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }}
73
- github_ref: ${{ github.ref }}
74
-
75
- - name: Insights
76
- id: insights
77
- uses: Codesee-io/codesee-map-action@latest
78
- with:
79
- step: insights
80
- api_token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }}
81
- github_ref: ${{ github.ref }}
@@ -1,123 +0,0 @@
1
- # This is a basic workflow to help you get started with Actions
2
-
3
- name: CI
4
-
5
- # Controls when the workflow will run
6
- on:
7
- # Triggers the workflow on push or pull request events but only for the main branch
8
- push:
9
- branches:
10
- - '*'
11
- pull_request:
12
- types: [opened, synchronize, reopened]
13
-
14
- # Allows you to run this workflow manually from the Actions tab
15
- workflow_dispatch:
16
-
17
- # A workflow run is made up of one or more jobs that can run sequentially or in parallel
18
- jobs:
19
- publish:
20
- runs-on: ubuntu-latest
21
-
22
- strategy:
23
- matrix:
24
- node-version: [16.x]
25
- # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
26
-
27
- services:
28
- postgres:
29
- image: postgres:13
30
- ports:
31
- - 5432:5432
32
- env:
33
- POSTGRES_PASSWORD: ""
34
- POSTGRES_HOST_AUTH_METHOD: "trust"
35
- # Set health checks to wait until postgres has started
36
- options: >-
37
- --health-cmd pg_isready
38
- --health-interval 10s
39
- --health-timeout 5s
40
- --health-retries 5
41
- redis:
42
- image: redis:6.2.5-alpine
43
- ports:
44
- - 6379:6379
45
- mongo:
46
- image: mongo:4.4.10
47
- ports:
48
- - 27017:27017
49
- mysql:
50
- image: mysql:5.7
51
- ports:
52
- - 3307:3306
53
- env:
54
- MYSQL_DATABASE: mysql
55
- MYSQL_ROOT_PASSWORD: mysql
56
- maria:
57
- image: mariadb:10.4.22
58
- ports:
59
- - 3306:3306
60
- env:
61
- MARIADB_DATABASE: mysql
62
- MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: "yes"
63
-
64
- steps:
65
- - uses: actions/checkout@v2
66
- - name: Use Node.js ${{ matrix.node-version }}
67
- uses: actions/setup-node@v2
68
- with:
69
- always-auth: true
70
- node-version: ${{ matrix.node-version }}
71
- registry-url: https://registry.npmjs.org
72
- scope: '@boxyhq'
73
- cache: 'npm'
74
- - run: npm ci
75
- - run: npm run test
76
- - run: |
77
- publishTag="latest"
78
- if [[ "$GITHUB_REF" == *\/release ]]
79
- then
80
- echo "Release branch"
81
- else
82
- echo "Dev branch"
83
- publishTag="beta"
84
- versionSuffixTag="-beta.${GITHUB_RUN_NUMBER}"
85
- sed "s/\(^[ ]*\"version\"\:[ ]*\".*\)\",/\1${versionSuffixTag}\",/" < package.json > package.json.new
86
- mv package.json.new package.json
87
- fi
88
- npm publish --tag $publishTag --access public
89
- env:
90
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
91
- build:
92
- needs: publish
93
- runs-on: ubuntu-latest
94
-
95
- steps:
96
- - name: Check Out Repo
97
- uses: actions/checkout@v2
98
-
99
- - name: Get short SHA
100
- id: slug
101
- run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)"
102
-
103
- - name: Set up Docker Buildx
104
- id: buildx
105
- uses: docker/setup-buildx-action@v1
106
-
107
- - name: Login to Docker Hub
108
- uses: docker/login-action@v1
109
- with:
110
- username: ${{ secrets.DOCKER_HUB_USERNAME }}
111
- password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
112
-
113
- - name: Build and push
114
- id: docker_build
115
- uses: docker/build-push-action@v2
116
- with:
117
- context: ./
118
- file: ./Dockerfile
119
- push: true
120
- tags: ${{ github.repository }}:latest,${{ github.repository }}:${{ steps.slug.outputs.sha7 }}
121
-
122
- - name: Image digest
123
- run: echo ${{ steps.docker_build.outputs.digest }}
@@ -1,37 +0,0 @@
1
- # this file is a helper to run all the supported dbs locally, the data is ephemeral since no host volumes will be mounted
2
- version: "3.6"
3
- services:
4
- postgres:
5
- image: postgres:13
6
- ports:
7
- - "5432:5432"
8
- restart: always
9
- environment:
10
- POSTGRES_PASSWORD: ""
11
- POSTGRES_HOST_AUTH_METHOD: trust
12
- redis:
13
- image: redis:6.2.5-alpine
14
- ports:
15
- - "6379:6379"
16
- restart: always
17
- mongo:
18
- image: mongo:4.4.10
19
- ports:
20
- - "27017:27017"
21
- restart: always
22
- mysql:
23
- image: mysql:5.7
24
- ports:
25
- - "3307:3306"
26
- restart: always
27
- environment:
28
- MYSQL_DATABASE: mysql
29
- MYSQL_ROOT_PASSWORD: mysql
30
- maria:
31
- image: mariadb:10.4.22
32
- ports:
33
- - "3306:3306"
34
- restart: always
35
- environment:
36
- MARIADB_DATABASE: mysql
37
- MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: "yes"
package/map.js DELETED
@@ -1 +0,0 @@
1
- module.exports = (test) => test.replace(/\.test\.js$/, '.js');