-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathconstants.ts
64 lines (55 loc) · 1.74 KB
/
constants.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
export const DEBUG = process.env.NODE_ENV !== "production";
export const EXTENSION_ID = "op-vscode";
export const QUALIFIED_EXTENSION_ID = `1Password.${EXTENSION_ID}`;
export const CONFIG_NAMESPACE = "1password";
const makeCommand = (command: string) => `${EXTENSION_ID}.${command}`;
export const COMMANDS = {
OPEN_1PASSWORD: makeCommand("open1Password"),
CHOOSE_ACCOUNT: makeCommand("chooseAccount"),
CHOOSE_VAULT: makeCommand("chooseVault"),
GET_VALUE_FROM_ITEM: makeCommand("getValueFromItem"),
SAVE_VALUE_TO_ITEM: makeCommand("saveValueToItem"),
INJECT_SECRETS: makeCommand("injectSecrets"),
CREATE_PASSWORD: makeCommand("createPassword"),
OPEN_LOGS: makeCommand("openLogs"),
IGNORE_PATTERN: makeCommand("ignorePattern"),
CREATE_CUSTOM_PATTERN: makeCommand("createCustomPattern"),
};
// This is only internal in that it is not exposed to the
// user. Other commands can still call these commands.
export const INTERNAL_COMMANDS = {
AUTHENTICATE: makeCommand("authenticate"),
};
export const STATE = {
ACCOUNT_UUID: "accountUuid",
ACCOUNT_URL: "accountUrl",
VAULT_ID: "vaultId",
DISABLE_CONFIG_REMINDER: "disableConfigReminder",
};
export const URLS = {
CLI_INSTALL_DOCS: "https://developer.1password.com/docs/cli/get-started",
CLI_UPGRADE_DOCS: "https://developer.1password.com/docs/cli/upgrade",
};
export const REGEXP = {
SECRET_REFERENCE:
/op:\/\/([\w -]+)\/([\w -]+)\/([\w -]+)(?:\/([\w -]+))?(?<! )/,
CAPITALIZED_WORDS: /(api|aws|id|uuid|url)/gi,
};
// Used for testing
export const SENSITIVE_FIELD_TYPES = [
"CONCEALED",
"SSHKEY",
"CREDIT_CARD_NUMBER",
] as const;
export const NONSENSITIVE_FIELD_TYPES = [
"ADDRESS",
"CREDIT_CARD_TYPE",
"DATE",
"EMAIL",
"GENDER",
"MENU",
"MONTH_YEAR",
"PHONE",
"STRING",
"URL",
] as const;