cloudcommerce 0.0.72 → 0.0.75
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/CHANGELOG.md +24 -0
- package/package.json +8 -8
- package/packages/api/package.json +1 -1
- package/packages/apps/correios/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/frenet/package.json +1 -1
- package/packages/apps/tiny-erp/package.json +1 -1
- package/packages/cli/config/firebase.json +47 -0
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/events/package.json +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/modules/lib/firebase/ajv.js +2 -1
- package/packages/modules/lib/firebase/ajv.js.map +1 -1
- package/packages/modules/lib/firebase/handle-module.js +5 -1
- package/packages/modules/lib/firebase/handle-module.js.map +1 -1
- package/packages/modules/lib/firebase/serve-modules-api.js +4 -3
- package/packages/modules/lib/firebase/serve-modules-api.js.map +1 -1
- package/packages/modules/package.json +2 -1
- package/packages/modules/schemas/@checkout.cjs +28 -28
- package/packages/modules/schemas/apply_discount.cjs +2 -2
- package/packages/modules/schemas/calculate_shipping.cjs +4 -4
- package/packages/modules/schemas/create_transaction.cjs +30 -30
- package/packages/modules/schemas/list_payments.cjs +6 -6
- package/packages/modules/src/firebase/ajv.ts +2 -1
- package/packages/modules/src/firebase/handle-module.ts +5 -1
- package/packages/modules/src/firebase/serve-modules-api.ts +5 -3
- package/packages/passport/package.json +1 -1
- package/packages/ssr/lib/firebase/serve-storefront.js +13 -32
- package/packages/ssr/lib/firebase/serve-storefront.js.map +1 -1
- package/packages/ssr/package.json +1 -1
- package/packages/ssr/src/firebase/serve-storefront.ts +13 -37
- package/packages/storefront/astro.config.mjs +2 -0
- package/packages/storefront/dist/client/LoginModal.d6b935cf.js +1 -0
- package/packages/storefront/dist/client/assets/{_...c08e0a75.css → _...27b7eb4d.css} +1 -1
- package/packages/storefront/dist/client/assets/_...b3f65c5c.css +1 -0
- package/packages/storefront/dist/client/assets/fallback-index.90217cf0.css +1 -0
- package/packages/storefront/dist/client/assets/{404.b3ead908.css → fallback.9cd2ed3f.css} +1 -1
- package/packages/storefront/dist/client/assets/{index.9745690c.css → index.c5a9ea80.css} +1 -1
- package/packages/storefront/dist/client/chunks/index.esm.69f70489.js +1726 -0
- package/packages/storefront/dist/client/chunks/index.esm2017.1194d1a1.js +457 -0
- package/packages/storefront/dist/client/chunks/runtime-core.esm-bundler.a7337834.js +1 -0
- package/packages/storefront/dist/client/client.80b904f3.js +1 -0
- package/packages/storefront/dist/client/hoisted.24787260.js +376 -0
- package/packages/storefront/dist/server/entry.mjs +466 -221
- package/packages/storefront/package.json +9 -7
- package/packages/storefront/src/assets/firebaseui.css +648 -0
- package/packages/storefront/src/lib/components/LoginModal.vue +42 -9
- package/packages/storefront/src/lib/layouts/Layout.astro +24 -0
- package/packages/storefront/src/lib/ssr-context.ts +54 -30
- package/packages/storefront/src/lib/views/{404.astro → fallback.astro} +1 -1
- package/packages/storefront/src/pages/[...slug].astro +7 -2
- package/packages/storefront/src/pages/{404.astro → fallback.astro} +2 -2
- package/packages/storefront/src/pages/index.astro +7 -2
- package/packages/types/package.json +1 -1
- package/packages/storefront/dist/client/assets/404-500-_...d4aa8aff.css +0 -1
- package/packages/storefront/dist/client/assets/404-500-index.d9230d24.css +0 -1
- package/packages/storefront/dist/client/assets/500.d5d7700b.css +0 -1
- package/packages/storefront/dist/client/client.6d48c590.js +0 -1
- package/packages/storefront/src/lib/views/500.astro +0 -79
- package/packages/storefront/src/pages/500.astro +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.0.75](https://github.com/ecomplus/cloud-commerce/compare/v0.0.74...v0.0.75) (2022-09-13)
|
|
6
|
+
|
|
7
|
+
### [0.0.74](https://github.com/ecomplus/cloud-commerce/compare/v0.0.73...v0.0.74) (2022-09-13)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **cli:** Update default `firbase.json` config with cache headers ([d9e3e99](https://github.com/ecomplus/cloud-commerce/commit/d9e3e995e26ce75c8d19748313fa31d0982629e5))
|
|
13
|
+
* **storefront:** Initialize Firebase app with Analytics ([2a5fe36](https://github.com/ecomplus/cloud-commerce/commit/2a5fe36dea7d3c1b0bfeeb66dc4866e5c6c13cd0))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **modules:** Fix schemas to draft-07 and properly call module handler ([#48](https://github.com/ecomplus/cloud-commerce/issues/48)) ([bd1fd5b](https://github.com/ecomplus/cloud-commerce/commit/bd1fd5b8e3f1b4c7f35ad66570f542738d388ac6))
|
|
19
|
+
|
|
20
|
+
### [0.0.73](https://github.com/ecomplus/cloud-commerce/compare/v0.0.72...v0.0.73) (2022-09-10)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* **ssr:** Fix fallback and errors and skip cache/redirect handled by Astro SSR ([abe19ae](https://github.com/ecomplus/cloud-commerce/commit/abe19ae585698c7621aa3bc6cf26bbf8f816824a))
|
|
26
|
+
* **storefront:** Must prefetch defined API endpoints also for non-slug pages (home) ([c55f201](https://github.com/ecomplus/cloud-commerce/commit/c55f201c76b96c19c334c460df35baa5715ac5b1))
|
|
27
|
+
* **storefront:** Send `X-SSR-Error` with error message only ([7fafde1](https://github.com/ecomplus/cloud-commerce/commit/7fafde110ee9b6d9139b2ad0f7959826c1b08e74))
|
|
28
|
+
|
|
5
29
|
### [0.0.72](https://github.com/ecomplus/cloud-commerce/compare/v0.0.71...v0.0.72) (2022-09-09)
|
|
6
30
|
|
|
7
31
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcommerce",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.75",
|
|
5
5
|
"description": "Open fair-code headless commerce platform: API-first, microservices based, event driven and cloud native",
|
|
6
6
|
"main": "packages/api/lib/index.js",
|
|
7
7
|
"author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"@commitlint/cli": "^17.1.2",
|
|
20
20
|
"@commitlint/config-conventional": "^17.1.0",
|
|
21
21
|
"@commitlint/rules": "^17.0.0",
|
|
22
|
-
"@types/node": "^18.
|
|
23
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
24
|
-
"@typescript-eslint/parser": "^5.
|
|
22
|
+
"@types/node": "^18.7.17",
|
|
23
|
+
"@typescript-eslint/eslint-plugin": "^5.37.0",
|
|
24
|
+
"@typescript-eslint/parser": "^5.37.0",
|
|
25
25
|
"esbuild": "^0.15.7",
|
|
26
|
-
"eslint": "^8.23.
|
|
26
|
+
"eslint": "^8.23.1",
|
|
27
27
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
28
28
|
"eslint-plugin-import": "^2.26.0",
|
|
29
29
|
"eslint-plugin-vue": "^9.4.0",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"node-fetch": "^3.2.10",
|
|
32
32
|
"standard-version": "^9.5.0",
|
|
33
33
|
"ts-node": "^10.9.1",
|
|
34
|
-
"turbo": "^1.4.
|
|
35
|
-
"typescript": "^4.8.
|
|
34
|
+
"turbo": "^1.4.6",
|
|
35
|
+
"typescript": "^4.8.3",
|
|
36
36
|
"vite": "^3.1.0",
|
|
37
|
-
"vitest": "^0.23.
|
|
37
|
+
"vitest": "^0.23.2",
|
|
38
38
|
"zx": "^7.0.8"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
@@ -54,6 +54,53 @@
|
|
|
54
54
|
"region": "southamerica-east1"
|
|
55
55
|
}
|
|
56
56
|
],
|
|
57
|
+
"headers": [
|
|
58
|
+
{
|
|
59
|
+
"source": "/api/**",
|
|
60
|
+
"headers": [
|
|
61
|
+
{
|
|
62
|
+
"key": "Cache-Control",
|
|
63
|
+
"value": "private, max-age=30, must-revalidate"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"source": "/img/**",
|
|
69
|
+
"headers": [
|
|
70
|
+
{
|
|
71
|
+
"key": "Cache-Control",
|
|
72
|
+
"value": "public, max-age=300, s-maxage=60, must-revalidate"
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"source": "/assets/**",
|
|
78
|
+
"headers": [
|
|
79
|
+
{
|
|
80
|
+
"key": "Cache-Control",
|
|
81
|
+
"value": "public, max-age=86400, s-maxage=600"
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"source": "/app/**",
|
|
87
|
+
"headers": [
|
|
88
|
+
{
|
|
89
|
+
"key": "Cache-Control",
|
|
90
|
+
"value": "public, max-age=600, stale-while-revalidate=900"
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"source": "**/*.?????*.@(js|css|webp|avif)",
|
|
96
|
+
"headers": [
|
|
97
|
+
{
|
|
98
|
+
"key": "Cache-Control",
|
|
99
|
+
"value": "public, max-age=31536000, immutable"
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
],
|
|
57
104
|
"cleanUrls": true
|
|
58
105
|
},
|
|
59
106
|
"storage": {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Ajv from 'ajv';
|
|
2
|
+
import addFormats from 'ajv-formats';
|
|
2
3
|
|
|
3
4
|
const ajvOptions = {
|
|
4
5
|
coerceTypes: false,
|
|
@@ -9,7 +10,7 @@ const ajvOptions = {
|
|
|
9
10
|
multipleOfPrecision: 5,
|
|
10
11
|
allowMatchingProperties: true,
|
|
11
12
|
};
|
|
12
|
-
const ajv = new Ajv(ajvOptions);
|
|
13
|
+
const ajv = addFormats(new Ajv(ajvOptions));
|
|
13
14
|
const parseAjvErrors = (errors, ajvInstance = ajv) => {
|
|
14
15
|
return ajvInstance.errorsText(errors, { separator: '\n' });
|
|
15
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ajv.js","sourceRoot":"","sources":["../../src/firebase/ajv.ts"],"names":[],"mappings":"AACA,OAAO,GAA6B,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"ajv.js","sourceRoot":"","sources":["../../src/firebase/ajv.ts"],"names":[],"mappings":"AACA,OAAO,GAA6B,MAAM,KAAK,CAAC;AAChD,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,MAAM,UAAU,GAAY;IAC1B,WAAW,EAAE,KAAK;IAClB,WAAW,EAAE,IAAI;IACjB,gBAAgB,EAAE,IAAI;IACtB,iFAAiF;IACjF,SAAS,EAAE,KAAK;IAChB,mBAAmB,EAAE,CAAC;IACtB,uBAAuB,EAAE,IAAI;CAC9B,CAAC;AACF,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;AAE5C,MAAM,cAAc,GAAG,CAAC,MAA6B,EAAE,WAAW,GAAG,GAAG,EAAE,EAAE;IAC1E,OAAO,WAAW,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC7D,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,GAAa,EAAE,OAAe,EAAE,MAA6B,EAAE,EAAE;IACzF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;QACnB,MAAM,EAAE,GAAG;QACX,UAAU,EAAE,QAAQ;QACpB,OAAO,EAAE,+EAA+E;QACxF,YAAY,EAAE;YACZ,KAAK,EAAE,GAAG,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;SACnD;QACD,SAAS,EAAE,IAAI,OAAO,SAAS;KAChC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,eAAe,GAAG,CAAC;AAEnB,OAAO,EACL,GAAG,EACH,UAAU,EACV,cAAc,EACd,gBAAgB,GACjB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { logger } from 'firebase-functions';
|
|
2
2
|
import Ajv from 'ajv';
|
|
3
|
+
import addFormats from 'ajv-formats';
|
|
3
4
|
import api from '@cloudcommerce/api';
|
|
4
5
|
import config from '@cloudcommerce/firebase/lib/config';
|
|
5
6
|
import {
|
|
@@ -7,7 +8,7 @@ import {
|
|
|
7
8
|
} from './ajv.js';
|
|
8
9
|
import callAppModule from './call-app-module.js';
|
|
9
10
|
|
|
10
|
-
const ajvAppsResponse = new Ajv({ ...ajvOptions, allErrors: true });
|
|
11
|
+
const ajvAppsResponse = addFormats(new Ajv({ ...ajvOptions, allErrors: true }));
|
|
11
12
|
// Cache apps list and no params modules results
|
|
12
13
|
const appsCache = {};
|
|
13
14
|
const resultsCache = {};
|
|
@@ -30,6 +31,9 @@ async function runModule(params, res, modName, validate, responseValidate, appId
|
|
|
30
31
|
};
|
|
31
32
|
if (appId
|
|
32
33
|
&& (typeof appId === 'number' || (typeof appId === 'string' && /^\d+$/.test(appId)))) {
|
|
34
|
+
if (typeof appId === 'string') {
|
|
35
|
+
appId = parseInt(appId, 10);
|
|
36
|
+
}
|
|
33
37
|
canCache = false;
|
|
34
38
|
listAppsParams.app_id = appId;
|
|
35
39
|
listAppsParams.limit = 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-module.js","sourceRoot":"","sources":["../../src/firebase/handle-module.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,GAAyB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AC;gBAChC,CAAC,EAAE,KAAK,CAAC,CAAC;aACX;YACD,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;KACJ;IACD,qBAAqB;IACrB,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC;AAED,eAAe,CACb,OAAe,EACf,MAA8B,EAC9B,cAAsC,EACtC,GAAY,EACZ,GAAa,EACb,EAAE;IACF,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,MAAM,gBAAgB,GAAG,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IACjE,OAAO;QACL,GAAG;YACD,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QACjE,CAAC;QACD,IAAI;YACF,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAClF,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -14,6 +14,7 @@ export default (req, res) => {
|
|
|
14
14
|
if (url.endsWith('.json')) {
|
|
15
15
|
url = url.slice(0, -5);
|
|
16
16
|
}
|
|
17
|
+
[url] = url.split('?');
|
|
17
18
|
const modName = url.split('/')[1];
|
|
18
19
|
const sendSchema = (isResponseSchema = false) => {
|
|
19
20
|
return res.status(200)
|
|
@@ -35,11 +36,11 @@ export default (req, res) => {
|
|
|
35
36
|
if (schemas[modName]) {
|
|
36
37
|
const { params: schema, response: responseSchema } = schemas[modName];
|
|
37
38
|
if (!schema.$schema) {
|
|
38
|
-
schema.$schema = 'http://json-schema.org/draft-
|
|
39
|
+
schema.$schema = 'http://json-schema.org/draft-07/schema#';
|
|
39
40
|
schema.title = `Module \`${modName}\`: Params model`;
|
|
40
41
|
}
|
|
41
42
|
if (!responseSchema.$schema) {
|
|
42
|
-
responseSchema.$schema = 'http://json-schema.org/draft-
|
|
43
|
+
responseSchema.$schema = 'http://json-schema.org/draft-07/schema#';
|
|
43
44
|
responseSchema.title = `Module \`${modName}\`: App response model`;
|
|
44
45
|
}
|
|
45
46
|
if (url === `/${modName}/schema`) {
|
|
@@ -49,7 +50,7 @@ export default (req, res) => {
|
|
|
49
50
|
return sendSchema(true);
|
|
50
51
|
}
|
|
51
52
|
if (url === `/${modName}`) {
|
|
52
|
-
return handleModule(modName, schema, responseSchema, req, res);
|
|
53
|
+
return handleModule(modName, schema, responseSchema, req, res)[method]();
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
return res.sendStatus(404);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve-modules-api.js","sourceRoot":"","sources":["../../src/firebase/serve-modules-api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAE3C,eAAe,CAAC,GAAY,EAAE,GAAa,EAAE,EAAE;IAC7C,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IACvB,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,KAAK,EAAE;QACzC,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;KAC5B;IACD,IACE,MAAM,KAAK,MAAM;WACd,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EACzE;QACA,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;KAC5B;IAED,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;IAClB,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QACzB,GAAG,GAAG,GAAG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AAE,MAAM,EAAE,cAAc,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;SAC1E;KACF;IACD,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/modules",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.75",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce modules API",
|
|
6
6
|
"main": "lib/index.cjs",
|
|
7
7
|
"exports": {
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"@cloudcommerce/app-frenet": "workspace:*",
|
|
32
32
|
"@cloudcommerce/firebase": "workspace:*",
|
|
33
33
|
"ajv": "^8.11.0",
|
|
34
|
+
"ajv-formats": "^2.1.1",
|
|
34
35
|
"axios": "^0.27.2",
|
|
35
36
|
"firebase-admin": "^11.0.1",
|
|
36
37
|
"firebase-functions": "^3.23.0",
|
|
@@ -25,8 +25,8 @@ exports.params = {
|
|
|
25
25
|
},
|
|
26
26
|
'number': {
|
|
27
27
|
'type': 'integer',
|
|
28
|
-
'
|
|
29
|
-
'
|
|
28
|
+
'minimum': 1,
|
|
29
|
+
'maximum': 9999999,
|
|
30
30
|
'description': 'House or building street number'
|
|
31
31
|
},
|
|
32
32
|
'complement': {
|
|
@@ -95,8 +95,8 @@ exports.params = {
|
|
|
95
95
|
'properties': {
|
|
96
96
|
'country_code': {
|
|
97
97
|
'type': 'integer',
|
|
98
|
-
'
|
|
99
|
-
'
|
|
98
|
+
'minimum': 1,
|
|
99
|
+
'maximum': 999,
|
|
100
100
|
'description': 'Country calling code (without +), defined by standards E.123 and E.164'
|
|
101
101
|
},
|
|
102
102
|
'number': {
|
|
@@ -230,20 +230,20 @@ exports.params = {
|
|
|
230
230
|
'properties': {
|
|
231
231
|
'day': {
|
|
232
232
|
'type': 'integer',
|
|
233
|
-
'
|
|
234
|
-
'
|
|
233
|
+
'minimum': 1,
|
|
234
|
+
'maximum': 31,
|
|
235
235
|
'description': 'Day of birth'
|
|
236
236
|
},
|
|
237
237
|
'month': {
|
|
238
238
|
'type': 'integer',
|
|
239
|
-
'
|
|
240
|
-
'
|
|
239
|
+
'minimum': 1,
|
|
240
|
+
'maximum': 12,
|
|
241
241
|
'description': 'Number of month of birth'
|
|
242
242
|
},
|
|
243
243
|
'year': {
|
|
244
244
|
'type': 'integer',
|
|
245
|
-
'
|
|
246
|
-
'
|
|
245
|
+
'minimum': 1800,
|
|
246
|
+
'maximum': 2200,
|
|
247
247
|
'description': 'Year of birth'
|
|
248
248
|
}
|
|
249
249
|
},
|
|
@@ -256,8 +256,8 @@ exports.params = {
|
|
|
256
256
|
'properties': {
|
|
257
257
|
'country_code': {
|
|
258
258
|
'type': 'integer',
|
|
259
|
-
'
|
|
260
|
-
'
|
|
259
|
+
'minimum': 1,
|
|
260
|
+
'maximum': 999,
|
|
261
261
|
'description': 'Country calling code (without +), defined by standards E.123 and E.164'
|
|
262
262
|
},
|
|
263
263
|
'number': {
|
|
@@ -320,20 +320,20 @@ exports.params = {
|
|
|
320
320
|
'properties': {
|
|
321
321
|
'day': {
|
|
322
322
|
'type': 'integer',
|
|
323
|
-
'
|
|
324
|
-
'
|
|
323
|
+
'minimum': 1,
|
|
324
|
+
'maximum': 31,
|
|
325
325
|
'description': 'Day of birth'
|
|
326
326
|
},
|
|
327
327
|
'month': {
|
|
328
328
|
'type': 'integer',
|
|
329
|
-
'
|
|
330
|
-
'
|
|
329
|
+
'minimum': 1,
|
|
330
|
+
'maximum': 12,
|
|
331
331
|
'description': 'Number of month of birth'
|
|
332
332
|
},
|
|
333
333
|
'year': {
|
|
334
334
|
'type': 'integer',
|
|
335
|
-
'
|
|
336
|
-
'
|
|
335
|
+
'minimum': 1800,
|
|
336
|
+
'maximum': 2200,
|
|
337
337
|
'description': 'Year of birth'
|
|
338
338
|
}
|
|
339
339
|
},
|
|
@@ -346,8 +346,8 @@ exports.params = {
|
|
|
346
346
|
'properties': {
|
|
347
347
|
'country_code': {
|
|
348
348
|
'type': 'integer',
|
|
349
|
-
'
|
|
350
|
-
'
|
|
349
|
+
'minimum': 1,
|
|
350
|
+
'maximum': 999,
|
|
351
351
|
'description': 'Country calling code (without +), defined by standards E.123 and E.164'
|
|
352
352
|
},
|
|
353
353
|
'number': {
|
|
@@ -409,8 +409,8 @@ exports.params = {
|
|
|
409
409
|
},
|
|
410
410
|
'bin': {
|
|
411
411
|
'type': 'integer',
|
|
412
|
-
'
|
|
413
|
-
'
|
|
412
|
+
'minimum': 1,
|
|
413
|
+
'maximum': 9999999,
|
|
414
414
|
'description': 'Issuer identification number (IIN), known as bank identification number (BIN)'
|
|
415
415
|
},
|
|
416
416
|
'company': {
|
|
@@ -431,8 +431,8 @@ exports.params = {
|
|
|
431
431
|
},
|
|
432
432
|
'cvv': {
|
|
433
433
|
'type': 'integer',
|
|
434
|
-
'
|
|
435
|
-
'
|
|
434
|
+
'minimum': 99,
|
|
435
|
+
'maximum': 99999,
|
|
436
436
|
'description': 'Credit card CVV number (Card Verification Value)'
|
|
437
437
|
},
|
|
438
438
|
'hash': {
|
|
@@ -829,8 +829,8 @@ exports.params = {
|
|
|
829
829
|
},
|
|
830
830
|
'channel_id': {
|
|
831
831
|
'type': 'integer',
|
|
832
|
-
'
|
|
833
|
-
'
|
|
832
|
+
'minimum': 10000,
|
|
833
|
+
'maximum': 4294967295,
|
|
834
834
|
'description': 'Channel unique identificator'
|
|
835
835
|
},
|
|
836
836
|
'channel_type': {
|
|
@@ -955,8 +955,8 @@ exports.params = {
|
|
|
955
955
|
'properties': {
|
|
956
956
|
'country_code': {
|
|
957
957
|
'type': 'integer',
|
|
958
|
-
'
|
|
959
|
-
'
|
|
958
|
+
'minimum': 1,
|
|
959
|
+
'maximum': 999,
|
|
960
960
|
'description': 'Country calling code (without +), defined by standards E.123 and E.164'
|
|
961
961
|
},
|
|
962
962
|
'number': {
|
|
@@ -22,8 +22,8 @@ const schema = {
|
|
|
22
22
|
},
|
|
23
23
|
'number': {
|
|
24
24
|
'type': 'integer',
|
|
25
|
-
'
|
|
26
|
-
'
|
|
25
|
+
'minimum': 1,
|
|
26
|
+
'maximum': 9999999,
|
|
27
27
|
'description': 'House or building street number'
|
|
28
28
|
},
|
|
29
29
|
'complement': {
|
|
@@ -92,8 +92,8 @@ const schema = {
|
|
|
92
92
|
'properties': {
|
|
93
93
|
'country_code': {
|
|
94
94
|
'type': 'integer',
|
|
95
|
-
'
|
|
96
|
-
'
|
|
95
|
+
'minimum': 1,
|
|
96
|
+
'maximum': 999,
|
|
97
97
|
'description': 'Country calling code (without +), defined by standards E.123 and E.164'
|
|
98
98
|
},
|
|
99
99
|
'number': {
|