@commercelayer/cli-core 4.12.1 → 5.0.0-beta.1
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/lib/index.d.mts +595 -0
- package/lib/index.d.ts +595 -0
- package/lib/index.js +11 -0
- package/lib/index.mjs +11 -0
- package/package.json +28 -34
- package/lib/cjs/api.d.ts +0 -41
- package/lib/cjs/api.js +0 -107
- package/lib/cjs/application.d.ts +0 -34
- package/lib/cjs/application.js +0 -36
- package/lib/cjs/color.d.ts +0 -107
- package/lib/cjs/color.js +0 -116
- package/lib/cjs/command.d.ts +0 -21
- package/lib/cjs/command.js +0 -95
- package/lib/cjs/config.d.ts +0 -92
- package/lib/cjs/config.js +0 -182
- package/lib/cjs/filter.d.ts +0 -10
- package/lib/cjs/filter.js +0 -81
- package/lib/cjs/help.d.ts +0 -17
- package/lib/cjs/help.js +0 -103
- package/lib/cjs/index.d.ts +0 -19
- package/lib/cjs/index.js +0 -46
- package/lib/cjs/inflector.d.ts +0 -26
- package/lib/cjs/inflector.js +0 -255
- package/lib/cjs/jsonapi.d.ts +0 -2
- package/lib/cjs/jsonapi.js +0 -38
- package/lib/cjs/output.d.ts +0 -28
- package/lib/cjs/output.js +0 -83
- package/lib/cjs/raw.d.ts +0 -12
- package/lib/cjs/raw.js +0 -49
- package/lib/cjs/schema.d.ts +0 -2
- package/lib/cjs/schema.js +0 -20
- package/lib/cjs/style.d.ts +0 -14
- package/lib/cjs/style.js +0 -39
- package/lib/cjs/symbol.d.ts +0 -2
- package/lib/cjs/symbol.js +0 -28
- package/lib/cjs/text.d.ts +0 -6
- package/lib/cjs/text.js +0 -23
- package/lib/cjs/token.d.ts +0 -58
- package/lib/cjs/token.js +0 -177
- package/lib/cjs/update.d.ts +0 -7
- package/lib/cjs/update.js +0 -22
- package/lib/cjs/util.d.ts +0 -9
- package/lib/cjs/util.js +0 -59
- package/lib/esm/api.d.ts +0 -41
- package/lib/esm/api.js +0 -93
- package/lib/esm/application.d.ts +0 -34
- package/lib/esm/application.js +0 -26
- package/lib/esm/color.d.ts +0 -107
- package/lib/esm/color.js +0 -110
- package/lib/esm/command.d.ts +0 -21
- package/lib/esm/command.js +0 -90
- package/lib/esm/config.d.ts +0 -92
- package/lib/esm/config.js +0 -180
- package/lib/esm/filter.d.ts +0 -10
- package/lib/esm/filter.js +0 -71
- package/lib/esm/help.d.ts +0 -17
- package/lib/esm/help.js +0 -100
- package/lib/esm/index.d.ts +0 -19
- package/lib/esm/index.js +0 -26
- package/lib/esm/inflector.d.ts +0 -26
- package/lib/esm/inflector.js +0 -253
- package/lib/esm/jsonapi.d.ts +0 -2
- package/lib/esm/jsonapi.js +0 -42
- package/lib/esm/output.d.ts +0 -28
- package/lib/esm/output.js +0 -72
- package/lib/esm/raw.d.ts +0 -12
- package/lib/esm/raw.js +0 -42
- package/lib/esm/schema.d.ts +0 -2
- package/lib/esm/schema.js +0 -14
- package/lib/esm/style.d.ts +0 -14
- package/lib/esm/style.js +0 -19
- package/lib/esm/symbol.d.ts +0 -2
- package/lib/esm/symbol.js +0 -25
- package/lib/esm/text.d.ts +0 -6
- package/lib/esm/text.js +0 -13
- package/lib/esm/token.d.ts +0 -58
- package/lib/esm/token.js +0 -166
- package/lib/esm/update.d.ts +0 -7
- package/lib/esm/update.js +0 -16
- package/lib/esm/util.d.ts +0 -9
- package/lib/esm/util.js +0 -51
- package/lib/tsconfig.esm.tsbuildinfo +0 -1
- package/lib/tsconfig.tsbuildinfo +0 -1
package/lib/esm/color.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
export const reset = chalk.reset;
|
|
3
|
-
export const visible = chalk.visible;
|
|
4
|
-
export const hidden = chalk.hidden;
|
|
5
|
-
export const red = chalk.red;
|
|
6
|
-
export const redBright = chalk.redBright;
|
|
7
|
-
export const green = chalk.green;
|
|
8
|
-
export const greenBright = chalk.greenBright;
|
|
9
|
-
export const yellow = chalk.yellow;
|
|
10
|
-
export const yellowBright = chalk.yellowBright;
|
|
11
|
-
export const blue = chalk.blue;
|
|
12
|
-
export const blueBright = chalk.blueBright;
|
|
13
|
-
export const white = chalk.white;
|
|
14
|
-
export const whiteBright = chalk.whiteBright;
|
|
15
|
-
export const black = chalk.black;
|
|
16
|
-
export const blackBright = chalk.blackBright;
|
|
17
|
-
export const grey = chalk.grey;
|
|
18
|
-
export const cyan = chalk.cyan;
|
|
19
|
-
export const cyanBright = chalk.cyanBright;
|
|
20
|
-
export const magenta = chalk.magenta;
|
|
21
|
-
export const magentaBright = chalk.magentaBright;
|
|
22
|
-
export const bold = chalk.bold;
|
|
23
|
-
export const dim = chalk.dim;
|
|
24
|
-
export const underline = chalk.underline;
|
|
25
|
-
export const italic = chalk.italic;
|
|
26
|
-
export const bg = {
|
|
27
|
-
white: chalk.bgWhite,
|
|
28
|
-
whiteBright: chalk.bgWhiteBright,
|
|
29
|
-
black: chalk.bgBlack,
|
|
30
|
-
blackBright: chalk.bgBlackBright,
|
|
31
|
-
grey: chalk.bgGrey,
|
|
32
|
-
red: chalk.bgRed,
|
|
33
|
-
redBright: chalk.bgRedBright,
|
|
34
|
-
green: chalk.bgGreen,
|
|
35
|
-
greenBright: chalk.bgGreenBright,
|
|
36
|
-
yellow: chalk.bgYellow,
|
|
37
|
-
yellowBright: chalk.bgYellowBright,
|
|
38
|
-
blue: chalk.bgBlue,
|
|
39
|
-
blueBright: chalk.bgBlueBright,
|
|
40
|
-
magenta: chalk.bgMagenta,
|
|
41
|
-
magentaBright: chalk.bgMagentaBright,
|
|
42
|
-
cyan: chalk.bgCyan,
|
|
43
|
-
cyanBright: chalk.bgCyanBright
|
|
44
|
-
};
|
|
45
|
-
export const style = {
|
|
46
|
-
organization: yellowBright.bold,
|
|
47
|
-
application: yellowBright.bold,
|
|
48
|
-
slug: yellowBright,
|
|
49
|
-
id: bold,
|
|
50
|
-
token: blueBright,
|
|
51
|
-
resource: bold,
|
|
52
|
-
attribute: italic,
|
|
53
|
-
trigger: cyanBright,
|
|
54
|
-
kind: cyanBright,
|
|
55
|
-
live: greenBright,
|
|
56
|
-
test: yellowBright,
|
|
57
|
-
execMode: (mode) => { return (mode === 'live') ? style.live : style.test; },
|
|
58
|
-
success: greenBright,
|
|
59
|
-
warning: yellowBright,
|
|
60
|
-
error: redBright,
|
|
61
|
-
arg: italic,
|
|
62
|
-
flag: italic,
|
|
63
|
-
command: italic,
|
|
64
|
-
value: italic,
|
|
65
|
-
alias: cyanBright,
|
|
66
|
-
plugin: blueBright,
|
|
67
|
-
title: blueBright,
|
|
68
|
-
path: italic,
|
|
69
|
-
datetime: cyanBright,
|
|
70
|
-
number: yellowBright,
|
|
71
|
-
};
|
|
72
|
-
/* Aliases */
|
|
73
|
-
export const type = {
|
|
74
|
-
datetime: style.datetime,
|
|
75
|
-
number: style.number,
|
|
76
|
-
path: style.path
|
|
77
|
-
};
|
|
78
|
-
/* Aliases */
|
|
79
|
-
export const api = {
|
|
80
|
-
organization: style.organization,
|
|
81
|
-
application: style.application,
|
|
82
|
-
slug: style.slug,
|
|
83
|
-
id: style.id,
|
|
84
|
-
token: style.token,
|
|
85
|
-
resource: style.resource,
|
|
86
|
-
attribute: style.attribute,
|
|
87
|
-
trigger: style.trigger,
|
|
88
|
-
kind: style.kind,
|
|
89
|
-
live: style.live,
|
|
90
|
-
test: style.test,
|
|
91
|
-
};
|
|
92
|
-
/* Aliases */
|
|
93
|
-
export const msg = {
|
|
94
|
-
success: style.success,
|
|
95
|
-
warning: style.warning,
|
|
96
|
-
error: style.error,
|
|
97
|
-
};
|
|
98
|
-
/* Aliases */
|
|
99
|
-
export const cli = {
|
|
100
|
-
arg: style.arg,
|
|
101
|
-
flag: style.flag,
|
|
102
|
-
command: style.command,
|
|
103
|
-
value: style.value,
|
|
104
|
-
alias: style.alias,
|
|
105
|
-
plugin: style.plugin
|
|
106
|
-
};
|
|
107
|
-
export const table = {
|
|
108
|
-
header: yellowBright.bold,
|
|
109
|
-
key: blueBright
|
|
110
|
-
};
|
package/lib/esm/command.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/** Copy command flags excluding a subset */
|
|
2
|
-
declare const commandFlags: <T extends object>(flags: T, exclude?: string[]) => T;
|
|
3
|
-
export { commandFlags };
|
|
4
|
-
export type KeyVal = Record<string, string | number | boolean | undefined | null>;
|
|
5
|
-
export type KeyValString = Record<string, string>;
|
|
6
|
-
export type KeyValArray = Record<string, string[]>;
|
|
7
|
-
export type KeyValRel = Record<string, {
|
|
8
|
-
readonly type: string;
|
|
9
|
-
readonly id: string;
|
|
10
|
-
}>;
|
|
11
|
-
export type KeyValObj = Record<string, any>;
|
|
12
|
-
export type KeyValSort = Record<string, 'asc' | 'desc'>;
|
|
13
|
-
export type ResAttributes = KeyValObj;
|
|
14
|
-
declare const fixValueType: (val: string) => string | number | boolean | null | undefined;
|
|
15
|
-
declare const findLongStringFlag: (args: string[], name: string) => {
|
|
16
|
-
value: string;
|
|
17
|
-
index: number;
|
|
18
|
-
single: boolean;
|
|
19
|
-
} | undefined;
|
|
20
|
-
declare const fixDashedFlagValue: (argv: string[], flag: any, name?: string, parsed?: any) => string[];
|
|
21
|
-
export { fixValueType, findLongStringFlag, fixDashedFlagValue };
|
package/lib/esm/command.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
2
|
-
/** Copy command flags excluding a subset */
|
|
3
|
-
const commandFlags = (flags, exclude) => {
|
|
4
|
-
const filteredFlags = Object.assign({}, flags);
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
6
|
-
if (exclude)
|
|
7
|
-
for (const e of exclude)
|
|
8
|
-
delete filteredFlags[e];
|
|
9
|
-
return filteredFlags;
|
|
10
|
-
};
|
|
11
|
-
export { commandFlags };
|
|
12
|
-
const fixValueType = (val) => {
|
|
13
|
-
let v = val;
|
|
14
|
-
if (v === 'null')
|
|
15
|
-
v = null; // null check
|
|
16
|
-
else
|
|
17
|
-
// eslint-disable-next-line eqeqeq
|
|
18
|
-
if (Number(v) == v)
|
|
19
|
-
v = Number(v); // number check
|
|
20
|
-
else
|
|
21
|
-
v = (v === 'true') ? true : (v === 'false') ? false : v; // boolean check
|
|
22
|
-
return v;
|
|
23
|
-
};
|
|
24
|
-
const findLongStringFlag = (args, name) => {
|
|
25
|
-
const flag = name.startsWith('--') ? name : `--${name}`;
|
|
26
|
-
let value;
|
|
27
|
-
const index = args.findIndex(arg => arg.startsWith(flag));
|
|
28
|
-
let single = false;
|
|
29
|
-
if (index > -1) {
|
|
30
|
-
const val = args[index];
|
|
31
|
-
if (val.includes('=')) {
|
|
32
|
-
const vals = val.split('=');
|
|
33
|
-
value = (vals.length === 2) ? vals[1] : '';
|
|
34
|
-
single = true;
|
|
35
|
-
}
|
|
36
|
-
else
|
|
37
|
-
value = args[index + 1];
|
|
38
|
-
return { value, index, single };
|
|
39
|
-
}
|
|
40
|
-
else
|
|
41
|
-
return undefined;
|
|
42
|
-
};
|
|
43
|
-
const fixDashedFlagValue = (argv, flag, name, parsed) => {
|
|
44
|
-
const TEMP_PREFIX = '____';
|
|
45
|
-
const name_ = flag.name || name;
|
|
46
|
-
const char_ = flag.char;
|
|
47
|
-
if (!name_ && !char_)
|
|
48
|
-
return argv;
|
|
49
|
-
const n = name_ ? (name_.startsWith('--') ? name_ : `--${name_}`) : undefined;
|
|
50
|
-
const c = char_ ? (flag.char.startsWith('-') ? char_ : `-${char_}`) : undefined;
|
|
51
|
-
let cidIdx = argv.findIndex(a => {
|
|
52
|
-
return ((c && a.startsWith(c)) || (n && a.startsWith(n)));
|
|
53
|
-
});
|
|
54
|
-
if (cidIdx < 0)
|
|
55
|
-
return argv;
|
|
56
|
-
let flagKey = argv[cidIdx];
|
|
57
|
-
let flagValue = '';
|
|
58
|
-
let prefix = '';
|
|
59
|
-
if (c && flagKey.startsWith(c)) {
|
|
60
|
-
flagValue = flagKey.replace(c, '').trim();
|
|
61
|
-
flagKey = c;
|
|
62
|
-
}
|
|
63
|
-
else if (n && flagKey.startsWith(n)) {
|
|
64
|
-
flagValue = flagKey.replace(n, '').trim();
|
|
65
|
-
flagKey = n;
|
|
66
|
-
}
|
|
67
|
-
else
|
|
68
|
-
return argv;
|
|
69
|
-
if (flagValue.startsWith('=')) {
|
|
70
|
-
flagValue = flagValue.slice(1);
|
|
71
|
-
prefix = flagKey + '=';
|
|
72
|
-
}
|
|
73
|
-
else if (!flagValue)
|
|
74
|
-
flagValue = argv[++cidIdx];
|
|
75
|
-
if (flagValue.startsWith('-') || flagValue.startsWith(TEMP_PREFIX)) {
|
|
76
|
-
const val = flagValue.startsWith(`${TEMP_PREFIX}`) ? flagValue.replace(`${TEMP_PREFIX}`, '') : flagValue.replace('-', `${TEMP_PREFIX}-`);
|
|
77
|
-
argv[cidIdx] = prefix + val;
|
|
78
|
-
if (flagValue.startsWith(TEMP_PREFIX) && parsed) {
|
|
79
|
-
const nameKey = name_ ? name_.replace('--', '') : undefined;
|
|
80
|
-
const parsedFlag = Object.entries(parsed.flags).find(([k, v]) => v === flagValue);
|
|
81
|
-
if (parsedFlag && (!nameKey || nameKey === parsedFlag[0]))
|
|
82
|
-
parsed.flags[parsedFlag[0]] = val;
|
|
83
|
-
const parsedRawFlag = Object.values(parsed.raw).find((f) => (f.type === 'flag') && (f.input === flagValue));
|
|
84
|
-
if (parsedRawFlag && (!nameKey || nameKey === parsedRawFlag.flag))
|
|
85
|
-
parsedRawFlag.input = val;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return argv;
|
|
89
|
-
};
|
|
90
|
-
export { fixValueType, findLongStringFlag, fixDashedFlagValue };
|
package/lib/esm/config.d.ts
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
type ApiConfig = {
|
|
2
|
-
default_domain: string;
|
|
3
|
-
default_app_domain: string;
|
|
4
|
-
default_stg_domain: string;
|
|
5
|
-
token_expiration_mins: number;
|
|
6
|
-
token_encoding_algorithm: string;
|
|
7
|
-
requests_max_num_burst: number;
|
|
8
|
-
requests_max_num_burst_cacheable: number;
|
|
9
|
-
requests_max_num_burst_test: number;
|
|
10
|
-
requests_max_num_burst_test_cacheable: number;
|
|
11
|
-
requests_max_secs_burst: number;
|
|
12
|
-
requests_max_num_avg: number;
|
|
13
|
-
requests_max_num_avg_cacheable: number;
|
|
14
|
-
requests_max_num_avg_test: number;
|
|
15
|
-
requests_max_num_avg_test_cacheable: number;
|
|
16
|
-
requests_max_secs_avg: number;
|
|
17
|
-
requests_max_num_oauth: number;
|
|
18
|
-
requests_max_secs_oauth: number;
|
|
19
|
-
page_max_size: number;
|
|
20
|
-
page_default_size: number;
|
|
21
|
-
};
|
|
22
|
-
type ApplicationConfig = {
|
|
23
|
-
kinds: readonly string[];
|
|
24
|
-
login_scopes: readonly string[];
|
|
25
|
-
};
|
|
26
|
-
type ImportsConfig = {
|
|
27
|
-
max_size: number;
|
|
28
|
-
statuses: readonly string[];
|
|
29
|
-
types: readonly string[];
|
|
30
|
-
max_queue_length: number;
|
|
31
|
-
attachment_expiration: number;
|
|
32
|
-
};
|
|
33
|
-
type ExportsConfig = {
|
|
34
|
-
max_size: number;
|
|
35
|
-
statuses: readonly string[];
|
|
36
|
-
types: readonly string[];
|
|
37
|
-
max_queue_length: number;
|
|
38
|
-
attachment_expiration: number;
|
|
39
|
-
};
|
|
40
|
-
type CleanupsConfig = {
|
|
41
|
-
max_size: number;
|
|
42
|
-
statuses: readonly string[];
|
|
43
|
-
types: readonly string[];
|
|
44
|
-
max_queue_length: number;
|
|
45
|
-
};
|
|
46
|
-
type WebhooksConfig = {
|
|
47
|
-
retry_number: number;
|
|
48
|
-
};
|
|
49
|
-
type CliConfig = {
|
|
50
|
-
applications: readonly string[];
|
|
51
|
-
};
|
|
52
|
-
type DocConfig = {
|
|
53
|
-
core: string;
|
|
54
|
-
core_api_reference: string;
|
|
55
|
-
core_how_tos: string;
|
|
56
|
-
core_raste_limits: string;
|
|
57
|
-
core_filtering_data: string;
|
|
58
|
-
metrics: string;
|
|
59
|
-
metrics_api_reference: string;
|
|
60
|
-
provisioning: string;
|
|
61
|
-
provisioning_api_reference: string;
|
|
62
|
-
imports_resources: string;
|
|
63
|
-
exports_resources: string;
|
|
64
|
-
cleanups_resources: string;
|
|
65
|
-
webhooks_events: string;
|
|
66
|
-
tags_resources: string;
|
|
67
|
-
};
|
|
68
|
-
type TagsConfig = {
|
|
69
|
-
max_resource_tags: number;
|
|
70
|
-
taggable_resources: readonly string[];
|
|
71
|
-
tag_name_max_length: number;
|
|
72
|
-
tag_name_pattern: RegExp;
|
|
73
|
-
};
|
|
74
|
-
type ProvisioningConfig = {
|
|
75
|
-
default_subdomain: string;
|
|
76
|
-
scope: string;
|
|
77
|
-
applications: readonly string[];
|
|
78
|
-
};
|
|
79
|
-
type Config = {
|
|
80
|
-
api: ApiConfig;
|
|
81
|
-
application: ApplicationConfig;
|
|
82
|
-
imports: ImportsConfig;
|
|
83
|
-
exports: ExportsConfig;
|
|
84
|
-
cleanups: CleanupsConfig;
|
|
85
|
-
webhooks: WebhooksConfig;
|
|
86
|
-
cli: CliConfig;
|
|
87
|
-
doc: DocConfig;
|
|
88
|
-
tags: TagsConfig;
|
|
89
|
-
provisioning: ProvisioningConfig;
|
|
90
|
-
};
|
|
91
|
-
declare const config: Config;
|
|
92
|
-
export default config;
|
package/lib/esm/config.js
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
const JOB_STATUSES = [
|
|
2
|
-
'in_progress',
|
|
3
|
-
'pending',
|
|
4
|
-
'completed',
|
|
5
|
-
'interrupted'
|
|
6
|
-
];
|
|
7
|
-
const IMPORT_RESOURCE_TYPES = [
|
|
8
|
-
'addresses',
|
|
9
|
-
'bundles',
|
|
10
|
-
'coupons',
|
|
11
|
-
'customer_addresses',
|
|
12
|
-
'customer_payment_sources',
|
|
13
|
-
'customer_subscriptions',
|
|
14
|
-
'customers',
|
|
15
|
-
'gift_cards',
|
|
16
|
-
'line_items',
|
|
17
|
-
'line_item_options',
|
|
18
|
-
'orders',
|
|
19
|
-
'price_tiers',
|
|
20
|
-
'prices',
|
|
21
|
-
'shipping_categories',
|
|
22
|
-
'sku_lists',
|
|
23
|
-
'sku_list_items',
|
|
24
|
-
'sku_options',
|
|
25
|
-
'skus',
|
|
26
|
-
'stock_items',
|
|
27
|
-
'tags',
|
|
28
|
-
'tax_categories'
|
|
29
|
-
];
|
|
30
|
-
const EXPORT_RESOURCE_TYPES = [
|
|
31
|
-
'addresses',
|
|
32
|
-
'authorizations',
|
|
33
|
-
'bundles',
|
|
34
|
-
'captures',
|
|
35
|
-
'coupons',
|
|
36
|
-
'customer_addresses',
|
|
37
|
-
'customer_subscriptions',
|
|
38
|
-
'customers',
|
|
39
|
-
'gift_cards',
|
|
40
|
-
'line_items',
|
|
41
|
-
'orders',
|
|
42
|
-
'payment_methods',
|
|
43
|
-
'price_tiers',
|
|
44
|
-
'prices',
|
|
45
|
-
'refunds',
|
|
46
|
-
'shipments',
|
|
47
|
-
'shipping_categories',
|
|
48
|
-
'shipping_methods',
|
|
49
|
-
'sku_lists',
|
|
50
|
-
'sku_list_items',
|
|
51
|
-
'sku_options',
|
|
52
|
-
'skus',
|
|
53
|
-
'stock_items',
|
|
54
|
-
'tags',
|
|
55
|
-
'tax_categories',
|
|
56
|
-
'transactions',
|
|
57
|
-
'voids'
|
|
58
|
-
];
|
|
59
|
-
const CLEANUP_RESOURCE_TYPES = [
|
|
60
|
-
'bundles',
|
|
61
|
-
'gift_cards',
|
|
62
|
-
'prices',
|
|
63
|
-
'promotions',
|
|
64
|
-
'sku_lists',
|
|
65
|
-
'sku_options',
|
|
66
|
-
'skus',
|
|
67
|
-
'stock_items'
|
|
68
|
-
];
|
|
69
|
-
const TAG_RESOURCE_TYPES = [
|
|
70
|
-
'addresses',
|
|
71
|
-
'bundles',
|
|
72
|
-
'customers',
|
|
73
|
-
'coupons',
|
|
74
|
-
'gift_cards',
|
|
75
|
-
'line_items',
|
|
76
|
-
'line_item_options',
|
|
77
|
-
'orders',
|
|
78
|
-
'returns',
|
|
79
|
-
'skus',
|
|
80
|
-
'sku_options',
|
|
81
|
-
'promotions',
|
|
82
|
-
'external_promotions',
|
|
83
|
-
'fixed_amount_promotions',
|
|
84
|
-
'fixed_price_promotions',
|
|
85
|
-
'free_gift_promotions',
|
|
86
|
-
'free_shipping_promotions',
|
|
87
|
-
'percentage_discount_promotions'
|
|
88
|
-
];
|
|
89
|
-
const RATE_LIMIT = {
|
|
90
|
-
erl_oauth_limit_live: 30,
|
|
91
|
-
erl_burst_limit_uncachable_live: 50,
|
|
92
|
-
erl_burst_limit_uncachable_test: 25,
|
|
93
|
-
erl_burst_limit_cachable_live: 250,
|
|
94
|
-
erl_burst_limit_cachable_test: 125,
|
|
95
|
-
erl_average_limit_uncachable_live: 200,
|
|
96
|
-
erl_average_limit_uncachable_test: 100,
|
|
97
|
-
erl_average_limit_cachable_live: 1000,
|
|
98
|
-
erl_average_limit_cachable_test: 500
|
|
99
|
-
};
|
|
100
|
-
const config = {
|
|
101
|
-
api: {
|
|
102
|
-
default_domain: 'commercelayer.io',
|
|
103
|
-
default_app_domain: 'commercelayer.app',
|
|
104
|
-
default_stg_domain: 'commercelayer.co',
|
|
105
|
-
token_expiration_mins: 60 * 4, // 4 hours (14400 secs)
|
|
106
|
-
token_encoding_algorithm: 'HS512',
|
|
107
|
-
requests_max_num_burst: RATE_LIMIT.erl_burst_limit_uncachable_live, // 50
|
|
108
|
-
requests_max_num_burst_cacheable: RATE_LIMIT.erl_burst_limit_cachable_live, // 250
|
|
109
|
-
requests_max_num_burst_test: RATE_LIMIT.erl_burst_limit_uncachable_test, // 25
|
|
110
|
-
requests_max_num_burst_test_cacheable: RATE_LIMIT.erl_burst_limit_cachable_test, // 125
|
|
111
|
-
requests_max_num_avg: RATE_LIMIT.erl_average_limit_uncachable_live, // 200
|
|
112
|
-
requests_max_num_avg_cacheable: RATE_LIMIT.erl_average_limit_cachable_live, // 1000
|
|
113
|
-
requests_max_num_avg_test: RATE_LIMIT.erl_average_limit_uncachable_test, // 100
|
|
114
|
-
requests_max_num_avg_test_cacheable: RATE_LIMIT.erl_average_limit_cachable_test, // 500
|
|
115
|
-
requests_max_num_oauth: RATE_LIMIT.erl_oauth_limit_live, // 30
|
|
116
|
-
requests_max_secs_burst: 10,
|
|
117
|
-
requests_max_secs_oauth: 60,
|
|
118
|
-
requests_max_secs_avg: 60,
|
|
119
|
-
page_max_size: 25,
|
|
120
|
-
page_default_size: 10,
|
|
121
|
-
},
|
|
122
|
-
application: {
|
|
123
|
-
kinds: ['integration', 'sales_channel', 'webapp', 'user'],
|
|
124
|
-
login_scopes: ['market', 'stock_location'],
|
|
125
|
-
},
|
|
126
|
-
imports: {
|
|
127
|
-
max_size: 5000,
|
|
128
|
-
statuses: JOB_STATUSES,
|
|
129
|
-
types: IMPORT_RESOURCE_TYPES,
|
|
130
|
-
max_queue_length: 10,
|
|
131
|
-
attachment_expiration: 5
|
|
132
|
-
},
|
|
133
|
-
exports: {
|
|
134
|
-
max_size: 10000,
|
|
135
|
-
statuses: JOB_STATUSES,
|
|
136
|
-
types: EXPORT_RESOURCE_TYPES,
|
|
137
|
-
max_queue_length: 10,
|
|
138
|
-
attachment_expiration: 5
|
|
139
|
-
},
|
|
140
|
-
cleanups: {
|
|
141
|
-
max_size: 10000,
|
|
142
|
-
statuses: JOB_STATUSES,
|
|
143
|
-
types: CLEANUP_RESOURCE_TYPES,
|
|
144
|
-
max_queue_length: 10
|
|
145
|
-
},
|
|
146
|
-
webhooks: {
|
|
147
|
-
retry_number: 5,
|
|
148
|
-
},
|
|
149
|
-
cli: {
|
|
150
|
-
applications: ['integration', 'sales_channel', 'user'],
|
|
151
|
-
},
|
|
152
|
-
doc: {
|
|
153
|
-
core: 'https://docs.commercelayer.io/core/',
|
|
154
|
-
core_api_reference: 'https://docs.commercelayer.io/developers/v/api-reference',
|
|
155
|
-
core_how_tos: 'https://docs.commercelayer.io/core/v/how-tos/',
|
|
156
|
-
core_raste_limits: 'https://docs.commercelayer.io/core/rate-limits',
|
|
157
|
-
core_filtering_data: 'https://docs.commercelayer.io/core/filtering-data#list-of-predicates',
|
|
158
|
-
metrics: 'https://docs.commercelayer.io/metrics/',
|
|
159
|
-
metrics_api_reference: 'https://docs.commercelayer.io/metrics/v/api-reference-m/',
|
|
160
|
-
provisioning: 'https://docs.commercelayer.io/provisioning/',
|
|
161
|
-
provisioning_api_reference: 'https://docs.commercelayer.io/provisioning/v/api-reference-p/',
|
|
162
|
-
imports_resources: 'https://docs.commercelayer.io/api/importing-resources#supported-resources',
|
|
163
|
-
exports_resources: 'https://docs.commercelayer.io/core/exporting-resources#supported-resources',
|
|
164
|
-
cleanups_resources: 'https://docs.commercelayer.io/core/cleaning-resources#supported-resources',
|
|
165
|
-
webhooks_events: 'https://docs.commercelayer.io/api/real-time-webhooks#supported-events',
|
|
166
|
-
tags_resources: 'https://docs.commercelayer.io/core/v/api-reference/tags#taggable-resources'
|
|
167
|
-
},
|
|
168
|
-
tags: {
|
|
169
|
-
max_resource_tags: 10,
|
|
170
|
-
taggable_resources: TAG_RESOURCE_TYPES,
|
|
171
|
-
tag_name_max_length: 25,
|
|
172
|
-
tag_name_pattern: /^[0-9A-Za-z_-]{1,25}$/
|
|
173
|
-
},
|
|
174
|
-
provisioning: {
|
|
175
|
-
default_subdomain: 'provisioning',
|
|
176
|
-
scope: 'provisioning-api',
|
|
177
|
-
applications: ['user']
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
export default config;
|
package/lib/esm/filter.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
declare const documentation: string;
|
|
2
|
-
interface Filter extends Record<string, unknown> {
|
|
3
|
-
predicate: string;
|
|
4
|
-
description: string;
|
|
5
|
-
}
|
|
6
|
-
declare const filterList: () => string[];
|
|
7
|
-
declare const filterAvailable: (filter: string) => boolean;
|
|
8
|
-
declare const applyFilter: (predicate: string, ...fields: string[]) => string;
|
|
9
|
-
declare const filters: () => Filter[];
|
|
10
|
-
export { type Filter, documentation, filterAvailable as available, filterList as list, applyFilter as apply, filters };
|
package/lib/esm/filter.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import config from "./config";
|
|
2
|
-
const FILTERS = [
|
|
3
|
-
{ predicate: '*_eq', description: 'The attribute is equal to the filter value' },
|
|
4
|
-
{ predicate: '*_not_eq', description: 'The attribute is not equal to the filter value' },
|
|
5
|
-
{ predicate: '*_matches', description: 'The attribute matches the filter value with "LIKE" operator' },
|
|
6
|
-
{ predicate: '*_does_not_match', description: 'The attribute does not match the filter value with "LIKE" operator' },
|
|
7
|
-
{ predicate: '*_matches_any', description: 'The attribute matches all of the filter values (comma-separated) with "LIKE" operator' },
|
|
8
|
-
{ predicate: '*_matches_all', description: 'The attribute matches all of the filter values (comma-separated) with "LIKE" operator' },
|
|
9
|
-
{ predicate: '*_does_not_match_any', description: 'The attribute does not match any of the filter values (comma-separated) with "LIKE" operator' },
|
|
10
|
-
{ predicate: '*_does_not_match_all', description: 'The attribute matches none of the filter values (comma-separated) with "LIKE" operator' },
|
|
11
|
-
{ predicate: '*_lt', description: 'The attribute is less than the filter value' },
|
|
12
|
-
{ predicate: '*_lteq', description: 'The attribute is less than or equal to the filter value' },
|
|
13
|
-
{ predicate: '*_gt', description: 'The attribute is greater than the filter value' },
|
|
14
|
-
{ predicate: '*_gteq', description: 'The attribute is greater than or equal to the filter value' },
|
|
15
|
-
{ predicate: '*_present', description: 'The attribute is not null and not empty' },
|
|
16
|
-
{ predicate: '*_blank', description: 'The attribute is null or empty' },
|
|
17
|
-
{ predicate: '*_null', description: 'The attribute is null' },
|
|
18
|
-
{ predicate: '*_not_null', description: 'The attribute is not null' },
|
|
19
|
-
{ predicate: '*_in', description: 'The attribute matches any of the filter values (comma-separated)' },
|
|
20
|
-
{ predicate: '*_not_in', description: 'The attribute matches none of the filter values (comma-separated)' },
|
|
21
|
-
{ predicate: '*_lt_any', description: 'The attribute is less than any of the filter values (comma-separated)' },
|
|
22
|
-
{ predicate: '*_lteq_any', description: 'The attribute is less than or equal to any of the filter values (comma-separated)' },
|
|
23
|
-
{ predicate: '*_gt_any', description: 'The attribute is greater than any of the filter values (comma-separated)' },
|
|
24
|
-
{ predicate: '*_gteq_any', description: 'The attribute is greater than or qual to any of the filter values (comma-separated)' },
|
|
25
|
-
{ predicate: '*_lt_all', description: 'The attribute is less than all of the filter values (comma-separated)' },
|
|
26
|
-
{ predicate: '*_lteq_all', description: 'The attribute is less than or equal to all of the filter values (comma-separated)' },
|
|
27
|
-
{ predicate: '*_gt_all', description: 'The attribute is greater than all of the filter values (comma-separated)' },
|
|
28
|
-
{ predicate: '*_gteq_all', description: 'The attribute is greater or equal to all of the filter values (comma-separated)' },
|
|
29
|
-
{ predicate: '*_not_eq_all', description: 'The attribute is equal to none of the filter values (comma-separated)' },
|
|
30
|
-
{ predicate: '*_start', description: 'The attribute starts with the filter value (comma-separated)' },
|
|
31
|
-
{ predicate: '*_not_start', description: 'The attribute does not start with the filter value (comma-separated)' },
|
|
32
|
-
{ predicate: '*_start_any', description: 'The attribute starts with any of the filter values (comma-separated)' },
|
|
33
|
-
{ predicate: '*_start_all', description: 'The attribute starts with all of the filter values (comma-separated)' },
|
|
34
|
-
{ predicate: '*_not_start_any', description: 'The attribute does not start with any of the filter values (comma-separated)' },
|
|
35
|
-
{ predicate: '*_not_start_all', description: 'The attribute starts with none of the filter values (comma-separated)' },
|
|
36
|
-
{ predicate: '*_end', description: 'The attribute ends with the filter value' },
|
|
37
|
-
{ predicate: '*_not_end', description: 'The attribute does not end with the filter value' },
|
|
38
|
-
{ predicate: '*_end_any', description: 'The attribute ends with any of the filter values (comma-separated)' },
|
|
39
|
-
{ predicate: '*_end_all', description: 'The attribute ends with all of the filter values (comma-separated)' },
|
|
40
|
-
{ predicate: '*_not_end_any', description: 'The attribute does not end with any of the filter values (comma-separated)' },
|
|
41
|
-
{ predicate: '*_not_end_all', description: 'The attribute ends with none of the filter values (comma-separated)' },
|
|
42
|
-
{ predicate: '*_cont', description: 'The attribute contains the filter value' },
|
|
43
|
-
{ predicate: '*_not_cont', description: 'The attribute does not contains the filter value' },
|
|
44
|
-
{ predicate: '*_cont_any', description: 'The attribute contains any of the filter values (comma-separated)' },
|
|
45
|
-
{ predicate: '*_cont_all', description: 'The attribute contains all of the filter values (comma-separated)' },
|
|
46
|
-
{ predicate: '*_not_cont_all', description: 'The attribute contains none of the filter values (comma-separated)' },
|
|
47
|
-
{ predicate: '*_jcont', description: 'The attribute contains a portion of the JSON used as filter value (works with object only)' },
|
|
48
|
-
{ predicate: '*_true', description: 'The attribute is true' },
|
|
49
|
-
{ predicate: '*_false', description: 'The attribute is false' },
|
|
50
|
-
];
|
|
51
|
-
const documentation = config.doc.core_filtering_data;
|
|
52
|
-
const filterList = () => {
|
|
53
|
-
return filters().map(f => f.predicate.replace(/^\*/g, ''));
|
|
54
|
-
};
|
|
55
|
-
const filterAvailable = (filter) => {
|
|
56
|
-
const filter_ = filter.startsWith('_') ? filter : `_${filter}`;
|
|
57
|
-
return filterList().some(f => filter_.endsWith(f));
|
|
58
|
-
};
|
|
59
|
-
const applyFilter = (predicate, ...fields) => {
|
|
60
|
-
if (!filterAvailable(predicate))
|
|
61
|
-
throw new Error('Unknown filter: ' + predicate);
|
|
62
|
-
let out = '';
|
|
63
|
-
for (const f of fields)
|
|
64
|
-
out += (out.length === 0 ? '' : '_or_') + f;
|
|
65
|
-
out += predicate.startsWith('_') ? predicate : `_${predicate}`;
|
|
66
|
-
return out;
|
|
67
|
-
};
|
|
68
|
-
const filters = () => {
|
|
69
|
-
return [...FILTERS];
|
|
70
|
-
};
|
|
71
|
-
export { documentation, filterAvailable as available, filterList as list, applyFilter as apply, filters };
|
package/lib/esm/help.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type Command, CommandHelp, Help, type Interfaces } from '@oclif/core';
|
|
2
|
-
declare class CLICommandHelp extends CommandHelp {
|
|
3
|
-
examples(examples: Command.Example[] | undefined | string): string | undefined;
|
|
4
|
-
}
|
|
5
|
-
export default class CLIBaseHelp extends Help {
|
|
6
|
-
showHelp(args: string[]): Promise<void>;
|
|
7
|
-
showRootHelp(): Promise<void>;
|
|
8
|
-
showTopicHelp(topic: Interfaces.Topic): Promise<void>;
|
|
9
|
-
showCommandHelp(command: Command.Cached): Promise<void>;
|
|
10
|
-
formatRoot(): string;
|
|
11
|
-
formatTopic(topic: Interfaces.Topic): string;
|
|
12
|
-
formatTopics(topics: Interfaces.Topic[]): string;
|
|
13
|
-
formatCommands(commands: Command.Cached[]): string;
|
|
14
|
-
formatCommand(command: Command.Cached): string;
|
|
15
|
-
getCommandHelpClass(command: Command.Cached): CLICommandHelp;
|
|
16
|
-
}
|
|
17
|
-
export {};
|