@oneblink/sdk 0.19.17 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +22 -21
- package/tenants/classes/FormsApps.d.ts +1 -3
- package/tenants/classes/FormsApps.js +3 -15
- package/tenants/classes/FormsApps.js.map +1 -1
- package/tenants/classes/TeamMembers.js.map +1 -1
- package/tenants/lib/forms-schema/property-schemas.d.ts +35 -35
- package/tenants/lib/generate-tenant.js +12 -0
- package/tenants/lib/generate-tenant.js.map +1 -1
- package/tenants/lib/tenant-configuration.js +4 -0
- package/tenants/lib/tenant-configuration.js.map +1 -1
- package/tenants/lib/upload-asset.js.map +1 -1
- package/tenants/lib/verify-jwt.d.ts +2 -0
- package/tenants/lib/verify-jwt.js +43 -0
- package/tenants/lib/verify-jwt.js.map +1 -0
- package/tenants/types.d.ts +5 -1
- package/tenants/types.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,41 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneblink/sdk",
|
|
3
3
|
"description": "OneBlink SDK to serve as an entry point for all OneBlink Services in NodeJS",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "1.0.0",
|
|
5
5
|
"author": "OneBlink <developers@oneblink.io> (https://oneblink.io)",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/oneblink/sdk-node-js/issues"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@oneblink/sdk-core": "^0.4.4
|
|
11
|
-
"joi": "^17.
|
|
10
|
+
"@oneblink/sdk-core": "^0.4.4",
|
|
11
|
+
"joi": "^17.7.0",
|
|
12
12
|
"jsonwebtoken": "^8.5.1",
|
|
13
|
+
"jwks-rsa": "^3.0.0",
|
|
13
14
|
"node-fetch": "^2.6.7",
|
|
14
|
-
"nodemailer": "^6.
|
|
15
|
-
"uuid": "^
|
|
15
|
+
"nodemailer": "^6.8.0",
|
|
16
|
+
"uuid": "^9.0.0"
|
|
16
17
|
},
|
|
17
18
|
"devDependencies": {
|
|
18
19
|
"@oneblink/release-cli": "^1.2.0",
|
|
19
20
|
"@oneblink/types": "github:oneblink/types",
|
|
20
|
-
"@types/content-disposition": "^0.5.
|
|
21
|
-
"@types/jest": "^
|
|
21
|
+
"@types/content-disposition": "^0.5.5",
|
|
22
|
+
"@types/jest": "^29.2.2",
|
|
22
23
|
"@types/joi": "^17.2.3",
|
|
23
|
-
"@types/jsonwebtoken": "^8.5.
|
|
24
|
-
"@types/node-fetch": "^2.6.
|
|
25
|
-
"@types/nodemailer": "^6.4.
|
|
24
|
+
"@types/jsonwebtoken": "^8.5.9",
|
|
25
|
+
"@types/node-fetch": "^2.6.2",
|
|
26
|
+
"@types/nodemailer": "^6.4.6",
|
|
26
27
|
"@types/uuid": "^8.3.4",
|
|
27
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
28
|
-
"@typescript-eslint/parser": "^5.
|
|
29
|
-
"eslint": "^8.
|
|
28
|
+
"@typescript-eslint/eslint-plugin": "^5.42.1",
|
|
29
|
+
"@typescript-eslint/parser": "^5.42.1",
|
|
30
|
+
"eslint": "^8.27.0",
|
|
30
31
|
"eslint-config-prettier": "^8.5.0",
|
|
31
|
-
"eslint-plugin-prettier": "^4.
|
|
32
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
32
33
|
"fixpack": "^4.0.0",
|
|
33
|
-
"jest": "^
|
|
34
|
-
"prettier": "^2.
|
|
35
|
-
"prettier-plugin-jsdoc": "^0.
|
|
36
|
-
"ts-jest": "^
|
|
37
|
-
"typedoc": "^0.
|
|
38
|
-
"typescript": "^4.
|
|
34
|
+
"jest": "^29.3.1",
|
|
35
|
+
"prettier": "^2.7.1",
|
|
36
|
+
"prettier-plugin-jsdoc": "^0.4.2",
|
|
37
|
+
"ts-jest": "^29.0.3",
|
|
38
|
+
"typedoc": "^0.23.20",
|
|
39
|
+
"typescript": "^4.8.4"
|
|
39
40
|
},
|
|
40
41
|
"directories": {
|
|
41
42
|
"doc": "docs",
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
"test": "test"
|
|
44
45
|
},
|
|
45
46
|
"engines": {
|
|
46
|
-
"node": ">=
|
|
47
|
+
"node": ">=14",
|
|
47
48
|
"npm": ">=8"
|
|
48
49
|
},
|
|
49
50
|
"files": [
|
|
@@ -17,7 +17,7 @@ export default class FormsApps extends OneBlinkAPI {
|
|
|
17
17
|
*/
|
|
18
18
|
constructor(options: ConstructorOptions);
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* A Static function to verify a JWT and return its result
|
|
21
21
|
*
|
|
22
22
|
* #### Example
|
|
23
23
|
*
|
|
@@ -38,8 +38,6 @@ export default class FormsApps extends OneBlinkAPI {
|
|
|
38
38
|
*
|
|
39
39
|
* @param token The JWT you wish to verify
|
|
40
40
|
*/
|
|
41
|
-
verifyJWT<T extends Record<string, unknown>>(token: string): Promise<T>;
|
|
42
|
-
/** @deprecated Use `(new FormsApps()).verifyJWT()` instead */
|
|
43
41
|
static verifyJWT<T extends Record<string, unknown>>(token: string): Promise<T>;
|
|
44
42
|
/**
|
|
45
43
|
* Get a single Forms App by its identifier
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const one_blink_api_1 = __importDefault(require("../lib/one-blink-api"));
|
|
7
|
-
const
|
|
7
|
+
const verify_jwt_1 = __importDefault(require("../lib/verify-jwt"));
|
|
8
8
|
const basePath = `/forms-apps`;
|
|
9
9
|
class FormsApps extends one_blink_api_1.default {
|
|
10
10
|
/**
|
|
@@ -25,7 +25,7 @@ class FormsApps extends one_blink_api_1.default {
|
|
|
25
25
|
super(options.accessKey, options.secretKey);
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* A Static function to verify a JWT and return its result
|
|
29
29
|
*
|
|
30
30
|
* #### Example
|
|
31
31
|
*
|
|
@@ -46,20 +46,8 @@ class FormsApps extends one_blink_api_1.default {
|
|
|
46
46
|
*
|
|
47
47
|
* @param token The JWT you wish to verify
|
|
48
48
|
*/
|
|
49
|
-
async verifyJWT(token) {
|
|
50
|
-
if (token.includes('Bearer ')) {
|
|
51
|
-
token = token.split(' ')[1];
|
|
52
|
-
}
|
|
53
|
-
await this.getMyFormsApp(token);
|
|
54
|
-
return jsonwebtoken_1.default.decode(token);
|
|
55
|
-
}
|
|
56
|
-
/** @deprecated Use `(new FormsApps()).verifyJWT()` instead */
|
|
57
49
|
static async verifyJWT(token) {
|
|
58
|
-
|
|
59
|
-
accessKey: 'not used',
|
|
60
|
-
secretKey: 'not used',
|
|
61
|
-
});
|
|
62
|
-
return await formsAppsClient.verifyJWT(token);
|
|
50
|
+
return (0, verify_jwt_1.default)(token, one_blink_api_1.default.tenant);
|
|
63
51
|
}
|
|
64
52
|
/**
|
|
65
53
|
* Get a single Forms App by its identifier
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormsApps.js","sourceRoot":"","sources":["../../src/classes/FormsApps.ts"],"names":[],"mappings":";;;;;AACA,yEAA8C;AAE9C,
|
|
1
|
+
{"version":3,"file":"FormsApps.js","sourceRoot":"","sources":["../../src/classes/FormsApps.ts"],"names":[],"mappings":";;;;;AACA,yEAA8C;AAE9C,mEAAyC;AAEzC,MAAM,QAAQ,GAAG,aAAa,CAAA;AAE9B,MAAqB,SAAU,SAAQ,uBAAW;IAChD;;;;;;;;;;;;OAYG;IACH,YAAY,OAA2B;QACrC,OAAO,GAAG,OAAO,IAAI,EAAE,CAAA;QACvB,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;IAC7C,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CAAC,KAAK,CAAC,SAAS,CACpB,KAAa;QAEb,OAAO,IAAA,oBAAS,EAAI,KAAK,EA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
{"version":3,"file":"TeamMembers.js","sourceRoot":"","sources":["../../src/classes/TeamMembers.ts"],"names":[],"mappings":";;;;;AACA,yEAA8C;AAG9C,MAAqB,WAAY,SAAQ,uBAAW;IAClD;;;;;;;;;;;;OAYG;IACH,YAAY,OAA2B;QACrC,OAAO,GAAG,OAAO,IAAI,EAAE,CAAA;QACvB,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;IAC7C,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,iBAAiB,CAAC,KAAa;QACnC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,iCAAiC,CAAC,CAAC,CAAA;SACxE;QAED,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,KAAK,CAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"TeamMembers.js","sourceRoot":"","sources":["../../src/classes/TeamMembers.ts"],"names":[],"mappings":";;;;;AACA,yEAA8C;AAG9C,MAAqB,WAAY,SAAQ,uBAAW;IAClD;;;;;;;;;;;;OAYG;IACH,YAAY,OAA2B;QACrC,OAAO,GAAG,OAAO,IAAI,EAAE,CAAA;QACvB,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;IAC7C,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,iBAAiB,CAAC,KAAa;QACnC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,iCAAiC,CAAC,CAAC,CAAA;SACxE;QAED,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,KAAK,CAAC,aAAa,CAE9C,cAAc,EAAE;YACjB,KAAK;SACN,CAAC,CAAA;QACF,IACE,CAAC,WAAW,CAAC,CAAC,CAAC;YACf,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK;YACrB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAC1B;YACA,OAAO,IAAI,CAAA;SACZ;QAED,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAA;IAClC,CAAC;CACF;AArDD,8BAqDC"}
|
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
import Joi from 'joi';
|
|
2
|
-
export declare const id: Joi.StringSchema
|
|
3
|
-
export declare const name: Joi.StringSchema
|
|
4
|
-
export declare const label: Joi.StringSchema
|
|
5
|
-
export declare const meta: Joi.StringSchema
|
|
2
|
+
export declare const id: Joi.StringSchema<string>;
|
|
3
|
+
export declare const name: Joi.StringSchema<string>;
|
|
4
|
+
export declare const label: Joi.StringSchema<string>;
|
|
5
|
+
export declare const meta: Joi.StringSchema<string>;
|
|
6
6
|
/**
|
|
7
7
|
* This property is spread onto every element schema. Any new properties that
|
|
8
8
|
* will be on ALL elements can be safely added here.
|
|
9
9
|
*/
|
|
10
10
|
export declare const baseSchemas: {
|
|
11
|
-
id: Joi.StringSchema
|
|
12
|
-
meta: Joi.StringSchema
|
|
11
|
+
id: Joi.StringSchema<string>;
|
|
12
|
+
meta: Joi.StringSchema<string>;
|
|
13
13
|
};
|
|
14
|
-
export declare const hint: Joi.StringSchema
|
|
14
|
+
export declare const hint: Joi.StringSchema<string>;
|
|
15
15
|
export declare const requiredSchemas: {
|
|
16
|
-
required: Joi.BooleanSchema
|
|
17
|
-
requiredMessage: Joi.StringSchema
|
|
16
|
+
required: Joi.BooleanSchema<boolean>;
|
|
17
|
+
requiredMessage: Joi.StringSchema<string>;
|
|
18
18
|
};
|
|
19
|
-
export declare const readOnly: Joi.BooleanSchema
|
|
20
|
-
export declare const placeholderValue: Joi.StringSchema
|
|
21
|
-
export declare const buttons: Joi.BooleanSchema
|
|
22
|
-
export declare const defaultValueOptionsSingle: Joi.AlternativesSchema
|
|
23
|
-
export declare const defaultValueOptionsMultiple: Joi.AlternativesSchema
|
|
19
|
+
export declare const readOnly: Joi.BooleanSchema<boolean>;
|
|
20
|
+
export declare const placeholderValue: Joi.StringSchema<string>;
|
|
21
|
+
export declare const buttons: Joi.BooleanSchema<boolean>;
|
|
22
|
+
export declare const defaultValueOptionsSingle: Joi.AlternativesSchema<any>;
|
|
23
|
+
export declare const defaultValueOptionsMultiple: Joi.AlternativesSchema<any>;
|
|
24
24
|
export declare const optionsSchemas: {
|
|
25
|
-
optionsType: Joi.StringSchema
|
|
26
|
-
dynamicOptionSetId: Joi.AlternativesSchema
|
|
27
|
-
options: Joi.AlternativesSchema
|
|
28
|
-
attributesMapping: Joi.AlternativesSchema
|
|
29
|
-
conditionallyShowOptions: Joi.AlternativesSchema
|
|
30
|
-
conditionallyShowOptionsElementIds: Joi.AlternativesSchema
|
|
31
|
-
freshdeskFieldName: Joi.AlternativesSchema
|
|
25
|
+
optionsType: Joi.StringSchema<string>;
|
|
26
|
+
dynamicOptionSetId: Joi.AlternativesSchema<any>;
|
|
27
|
+
options: Joi.AlternativesSchema<any>;
|
|
28
|
+
attributesMapping: Joi.AlternativesSchema<any>;
|
|
29
|
+
conditionallyShowOptions: Joi.AlternativesSchema<any>;
|
|
30
|
+
conditionallyShowOptionsElementIds: Joi.AlternativesSchema<any>;
|
|
31
|
+
freshdeskFieldName: Joi.AlternativesSchema<any>;
|
|
32
32
|
};
|
|
33
33
|
export declare const ConditionalPredicatesItemSchema: Joi.ObjectSchema<any>;
|
|
34
|
-
export declare const conditionallyShowPredicates: Joi.AlternativesSchema
|
|
34
|
+
export declare const conditionallyShowPredicates: Joi.AlternativesSchema<any>;
|
|
35
35
|
export declare const lookupSchemas: {
|
|
36
|
-
isDataLookup: Joi.BooleanSchema
|
|
37
|
-
dataLookupId: Joi.AlternativesSchema
|
|
38
|
-
isElementLookup: Joi.BooleanSchema
|
|
39
|
-
elementLookupId: Joi.AlternativesSchema
|
|
36
|
+
isDataLookup: Joi.BooleanSchema<boolean>;
|
|
37
|
+
dataLookupId: Joi.AlternativesSchema<any>;
|
|
38
|
+
isElementLookup: Joi.BooleanSchema<boolean>;
|
|
39
|
+
elementLookupId: Joi.AlternativesSchema<any>;
|
|
40
40
|
};
|
|
41
41
|
export declare const conditionallyShowSchemas: {
|
|
42
|
-
conditionallyShow: Joi.BooleanSchema
|
|
43
|
-
requiresAllConditionallyShowPredicates: Joi.AlternativesSchema
|
|
44
|
-
conditionallyShowPredicates: Joi.AlternativesSchema
|
|
42
|
+
conditionallyShow: Joi.BooleanSchema<boolean>;
|
|
43
|
+
requiresAllConditionallyShowPredicates: Joi.AlternativesSchema<any>;
|
|
44
|
+
conditionallyShowPredicates: Joi.AlternativesSchema<any>;
|
|
45
45
|
};
|
|
46
|
-
export declare const storageType: Joi.StringSchema
|
|
46
|
+
export declare const storageType: Joi.StringSchema<string>;
|
|
47
47
|
export declare const regexSchemas: {
|
|
48
|
-
regexPattern: Joi.StringSchema
|
|
49
|
-
regexFlags: Joi.AlternativesSchema
|
|
50
|
-
regexMessage: Joi.StringSchema
|
|
48
|
+
regexPattern: Joi.StringSchema<string>;
|
|
49
|
+
regexFlags: Joi.AlternativesSchema<any>;
|
|
50
|
+
regexMessage: Joi.StringSchema<string>;
|
|
51
51
|
};
|
|
52
|
-
export declare const canToggleAll: Joi.BooleanSchema
|
|
53
|
-
export declare const customCssClasses: Joi.ArraySchema
|
|
52
|
+
export declare const canToggleAll: Joi.BooleanSchema<boolean>;
|
|
53
|
+
export declare const customCssClasses: Joi.ArraySchema<any[]>;
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jwks_rsa_1 = __importDefault(require("jwks-rsa"));
|
|
3
7
|
function generateTenant(tenantConfiguration) {
|
|
4
8
|
const isTest = process.env.ONEBLINK_SDK_ENVIRONMENT === 'test';
|
|
9
|
+
const jwtIssuer = isTest
|
|
10
|
+
? tenantConfiguration.test.jwtIssuer
|
|
11
|
+
: tenantConfiguration.prod.jwtIssuer;
|
|
5
12
|
return {
|
|
6
13
|
awsRegion: tenantConfiguration.awsRegion,
|
|
7
14
|
apiOrigin: isTest
|
|
8
15
|
? tenantConfiguration.test.apiOrigin
|
|
9
16
|
: tenantConfiguration.prod.apiOrigin,
|
|
17
|
+
jwtIssuer,
|
|
18
|
+
jwksInstance: (0, jwks_rsa_1.default)({
|
|
19
|
+
cache: true,
|
|
20
|
+
jwksUri: `${jwtIssuer}/.well-known/jwks.json`,
|
|
21
|
+
}),
|
|
10
22
|
};
|
|
11
23
|
}
|
|
12
24
|
exports.default = generateTenant;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-tenant.js","sourceRoot":"","sources":["../../src/lib/generate-tenant.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-tenant.js","sourceRoot":"","sources":["../../src/lib/generate-tenant.ts"],"names":[],"mappings":";;;;;AAAA,wDAAiC;AAGjC,SAAwB,cAAc,CACpC,mBAAwC;IAExC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,KAAK,MAAM,CAAA;IAE9D,MAAM,SAAS,GAAG,MAAM;QACtB,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,SAAS;QACpC,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAA;IAEtC,OAAO;QACL,SAAS,EAAE,mBAAmB,CAAC,SAAS;QACxC,SAAS,EAAE,MAAM;YACf,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,SAAS;YACpC,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,SAAS;QACtC,SAAS;QACT,YAAY,EAAE,IAAA,kBAAU,EAAC;YACvB,KAAK,EAAE,IAAI;YACX,OAAO,EAAE,GAAG,SAAS,wBAAwB;SAC9C,CAAC;KACH,CAAA;AACH,CAAC;AApBD,iCAoBC"}
|
|
@@ -4,18 +4,22 @@ exports.CIVICPLUS = exports.ONEBLINK = void 0;
|
|
|
4
4
|
exports.ONEBLINK = {
|
|
5
5
|
awsRegion: 'ap-southeast-2',
|
|
6
6
|
test: {
|
|
7
|
+
jwtIssuer: 'https://cognito-idp.ap-southeast-2.amazonaws.com/ap-southeast-2_AfFQWsYIH',
|
|
7
8
|
apiOrigin: 'https://auth-api.test.blinkm.io',
|
|
8
9
|
},
|
|
9
10
|
prod: {
|
|
11
|
+
jwtIssuer: 'https://cognito-idp.ap-southeast-2.amazonaws.com/ap-southeast-2_7kAsz3n3x',
|
|
10
12
|
apiOrigin: 'https://auth-api.blinkm.io',
|
|
11
13
|
},
|
|
12
14
|
};
|
|
13
15
|
exports.CIVICPLUS = {
|
|
14
16
|
awsRegion: 'us-east-2',
|
|
15
17
|
test: {
|
|
18
|
+
jwtIssuer: 'https://cognito-idp.us-east-2.amazonaws.com/us-east-2_rvIeXcSue',
|
|
16
19
|
apiOrigin: 'https://auth-api.test.transform.civicplus.com',
|
|
17
20
|
},
|
|
18
21
|
prod: {
|
|
22
|
+
jwtIssuer: 'https://cognito-idp.us-east-2.amazonaws.com/us-east-2_PmyuuhfWj',
|
|
19
23
|
apiOrigin: 'https://auth-api.transform.civicplus.com',
|
|
20
24
|
},
|
|
21
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tenant-configuration.js","sourceRoot":"","sources":["../../src/lib/tenant-configuration.ts"],"names":[],"mappings":";;;AAEa,QAAA,QAAQ,GAAwB;IAC3C,SAAS,EAAE,gBAAgB;IAC3B,IAAI,EAAE;QACJ,SAAS,EAAE,iCAAiC;KAC7C;IACD,IAAI,EAAE;QACJ,SAAS,EAAE,4BAA4B;KACxC;CACF,CAAA;AAEY,QAAA,SAAS,GAAwB;IAC5C,SAAS,EAAE,WAAW;IACtB,IAAI,EAAE;QACJ,SAAS,EAAE,+CAA+C;KAC3D;IACD,IAAI,EAAE;QACJ,SAAS,EAAE,0CAA0C;KACtD;CACF,CAAA"}
|
|
1
|
+
{"version":3,"file":"tenant-configuration.js","sourceRoot":"","sources":["../../src/lib/tenant-configuration.ts"],"names":[],"mappings":";;;AAEa,QAAA,QAAQ,GAAwB;IAC3C,SAAS,EAAE,gBAAgB;IAC3B,IAAI,EAAE;QACJ,SAAS,EACP,2EAA2E;QAC7E,SAAS,EAAE,iCAAiC;KAC7C;IACD,IAAI,EAAE;QACJ,SAAS,EACP,2EAA2E;QAC7E,SAAS,EAAE,4BAA4B;KACxC;CACF,CAAA;AAEY,QAAA,SAAS,GAAwB;IAC5C,SAAS,EAAE,WAAW;IACtB,IAAI,EAAE;QACJ,SAAS,EACP,iEAAiE;QACnE,SAAS,EAAE,+CAA+C;KAC3D;IACD,IAAI,EAAE;QACJ,SAAS,EACP,iEAAiE;QACnE,SAAS,EAAE,0CAA0C;KACtD;CACF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-asset.js","sourceRoot":"","sources":["../../src/lib/upload-asset.ts"],"names":[],"mappings":";;;;;AAAA,sDAAyB;
|
|
1
|
+
{"version":3,"file":"upload-asset.js","sourceRoot":"","sources":["../../src/lib/upload-asset.ts"],"names":[],"mappings":";;;;;AAAA,sDAAyB;AAIV,KAAK,UAAU,WAAW,CACvC,gBAA6B,EAC7B,IAAO,EACP,gBAAyB;IAEzB,MAAM,EAAE,GAAG,IAAI,iBAAG,CAAC,EAAE,CAAC;QACpB,MAAM,EAAE,gBAAgB,CAAC,EAAE,CAAC,MAAM;QAClC,WAAW,EAAE,gBAAgB,CAAC,WAAW,CAAC,WAAW;QACrD,eAAe,EAAE,gBAAgB,CAAC,WAAW,CAAC,eAAe;QAC7D,YAAY,EAAE,gBAAgB,CAAC,WAAW,CAAC,YAAY;KACxD,CAAC,CAAA;IAEF,MAAM,UAAU,GAAqB;QACnC,MAAM,EAAE,gBAAgB,CAAC,EAAE,CAAC,MAAM;QAClC,GAAG,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG;QAC5B,IAAI,EAAE,IAAgC;QACtC,OAAO,EAAE,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC;QACvE,YAAY,EAAE,kBAAkB;QAChC,WAAW,EAAE,gBAAgB;QAC7B,GAAG,EAAE,aAAa;KACnB,CAAA;IACD,MAAM,aAAa,GAAG;QACpB,QAAQ,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI;QACzB,SAAS,EAAE,CAAC;KACb,CAAA;IACD,OAAO,MAAM,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC,OAAO,EAAE,CAAA;AAC7D,CAAC;AA1BD,8BA0BC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
7
|
+
async function verifyJwt(token, tenant) {
|
|
8
|
+
if (token.includes('Bearer ')) {
|
|
9
|
+
token = token.split(' ')[1];
|
|
10
|
+
}
|
|
11
|
+
const getSigningKey = (header, callback) => {
|
|
12
|
+
if (!header.kid) {
|
|
13
|
+
callback(new Error('jwt does not contain a "kid" claim'));
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
tenant.jwksInstance.getSigningKey(header.kid, (error, key) => {
|
|
17
|
+
if (error) {
|
|
18
|
+
callback(error);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
callback(null, key === null || key === void 0 ? void 0 : key.getPublicKey());
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
return await new Promise((resolve, reject) => {
|
|
26
|
+
jsonwebtoken_1.default.verify(token, getSigningKey, {
|
|
27
|
+
algorithms: ['RS256'],
|
|
28
|
+
issuer: tenant.jwtIssuer,
|
|
29
|
+
}, (error, decoded) => {
|
|
30
|
+
if (error) {
|
|
31
|
+
reject(error);
|
|
32
|
+
}
|
|
33
|
+
else if (!decoded) {
|
|
34
|
+
reject(new Error('Could not decode token payload'));
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
resolve(decoded);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
exports.default = verifyJwt;
|
|
43
|
+
//# sourceMappingURL=verify-jwt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-jwt.js","sourceRoot":"","sources":["../../src/lib/verify-jwt.ts"],"names":[],"mappings":";;;;;AAAA,gEAAiE;AAGlD,KAAK,UAAU,SAAS,CACrC,KAAa,EACb,MAAc;IAEd,IAAI,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;QAC7B,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;KAC5B;IAED,MAAM,aAAa,GAAG,CAAC,MAAiB,EAAE,QAA4B,EAAE,EAAE;QACxE,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE;YACf,QAAQ,CAAC,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC,CAAA;YACzD,OAAM;SACP;QACD,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YAC3D,IAAI,KAAK,EAAE;gBACT,QAAQ,CAAC,KAAK,CAAC,CAAA;aAChB;iBAAM;gBACL,QAAQ,CAAC,IAAI,EAAE,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,YAAY,EAAE,CAAC,CAAA;aACpC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAA;IAED,OAAO,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,sBAAG,CAAC,MAAM,CACR,KAAK,EACL,aAAa,EACb;YACE,UAAU,EAAE,CAAC,OAAO,CAAC;YACrB,MAAM,EAAE,MAAM,CAAC,SAAS;SACzB,EACD,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YACjB,IAAI,KAAK,EAAE;gBACT,MAAM,CAAC,KAAK,CAAC,CAAA;aACd;iBAAM,IAAI,CAAC,OAAO,EAAE;gBACnB,MAAM,CAAC,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC,CAAA;aACpD;iBAAM;gBACL,OAAO,CAAC,OAAY,CAAC,CAAA;aACtB;QACH,CAAC,CACF,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC;AAzCD,4BAyCC"}
|
package/tenants/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ApprovalTypes, EmailTemplateTypes, EnvironmentTypes, FormTypes, SubmissionTypes, MiscTypes, AWSTypes, SchedulingTypes } from '@oneblink/types';
|
|
2
2
|
import { FormStoreRecord } from '@oneblink/types/typescript/submissions';
|
|
3
3
|
import { HeadObjectOutput } from 'aws-sdk/clients/s3';
|
|
4
|
+
import jwksClient from 'jwks-rsa';
|
|
4
5
|
import { SendMailOptions } from 'nodemailer';
|
|
5
6
|
export * from '@oneblink/types';
|
|
6
7
|
export { HeadObjectOutput };
|
|
@@ -22,12 +23,15 @@ export declare type TenantBase = {
|
|
|
22
23
|
};
|
|
23
24
|
export declare type TenantEnvironment = {
|
|
24
25
|
apiOrigin: string;
|
|
26
|
+
jwtIssuer: string;
|
|
25
27
|
};
|
|
26
28
|
export declare type TenantConfiguration = TenantBase & {
|
|
27
29
|
test: TenantEnvironment;
|
|
28
30
|
prod: TenantEnvironment;
|
|
29
31
|
};
|
|
30
|
-
export declare type Tenant = TenantBase & TenantEnvironment
|
|
32
|
+
export declare type Tenant = TenantBase & TenantEnvironment & {
|
|
33
|
+
jwksInstance: jwksClient.JwksClient;
|
|
34
|
+
};
|
|
31
35
|
export declare type FormSubmissionApprovalHistoryRecord = {
|
|
32
36
|
formSubmissionMeta: SubmissionTypes.FormSubmissionMeta;
|
|
33
37
|
formApprovalFlowInstance: ApprovalTypes.FormApprovalFlowInstance;
|
package/tenants/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAcA,kDAA+B"}
|