dotsec 2.0.0-alpha.1 → 4.0.0-alpha.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/dist/index.d.ts DELETED
@@ -1,148 +0,0 @@
1
- import Ajv from 'ajv';
2
- import { Command } from 'commander';
3
- export { default as Table } from 'cli-table';
4
-
5
- type DotsecCliPluginHandler<HandlerArgs extends Record<string, unknown>, HandlerResult, T extends Record<string, unknown> = Record<string, unknown>> = {
6
- encryptionEngineName?: string;
7
- triggerOptionValue: string;
8
- options?: {
9
- [key in keyof T]: DotsecCliOption;
10
- };
11
- requiredOptions?: {
12
- [key in keyof T]: DotsecCliOption;
13
- };
14
- handler: (options: HandlerArgs & T) => Promise<HandlerResult>;
15
- };
16
- type DotsecCliPluginEncryptHandler<HandlerPluginArgs extends Record<string, unknown> = Record<string, unknown>> = DotsecCliPluginHandler<{
17
- plaintext: string;
18
- }, string, HandlerPluginArgs>;
19
- type DotsecCliPluginDecryptHandler<HandlerPluginArgs extends Record<string, unknown> = Record<string, unknown>> = DotsecCliPluginHandler<{
20
- ciphertext: string;
21
- }, string, HandlerPluginArgs>;
22
- type DotsecCliPluginRunHandler<HandlerPluginArgs extends Record<string, unknown> = Record<string, unknown>> = DotsecCliPluginHandler<{
23
- ciphertext: string;
24
- }, string, HandlerPluginArgs>;
25
- type DotsecCliPluginPushHandler<HandlerPluginArgs extends Record<string, unknown> = Record<string, unknown>> = DotsecCliPluginHandler<{
26
- push: Record<string, string>;
27
- yes?: boolean;
28
- }, string, HandlerPluginArgs>;
29
- type DotsecCliOption = [
30
- flags: string,
31
- description?: string,
32
- defaultValue?: string | boolean | string[]
33
- ] | {
34
- flags: string;
35
- description?: string;
36
- defaultValue?: string | boolean | string[];
37
- fn?: (value: string, previous: unknown) => unknown;
38
- regexp?: RegExp;
39
- env?: string;
40
- };
41
- type DotsecPluginConfig = {
42
- module?: string;
43
- config?: {
44
- [key: string]: unknown;
45
- };
46
- push?: {
47
- [key: string]: unknown;
48
- };
49
- };
50
- type DotsecPlugins = {
51
- plugins: DotsecPlugin;
52
- };
53
- type Meh<T extends DotsecPluginModuleConfig> = T extends DotsecPluginModuleConfig ? T : never;
54
- type DotsecPluginModuleConfig = {
55
- plugin: DotsecPlugin;
56
- api?: Record<string, unknown>;
57
- cliHandlersOptions?: {
58
- encrypt?: Record<string, unknown>;
59
- decrypt?: Record<string, unknown>;
60
- run?: Record<string, unknown>;
61
- push?: Record<string, unknown>;
62
- };
63
- };
64
- type DotsecPluginModule<T extends DotsecPluginModuleConfig = DotsecPluginModuleConfig> = (options: {
65
- dotsecConfig: DotsecConfig;
66
- ajv: Ajv;
67
- configFile: string;
68
- }) => Promise<{
69
- name: keyof T["plugin"] | string;
70
- encryptionEngineName?: string;
71
- api?: T["api"] extends Record<string, unknown> ? T["api"] : never;
72
- addCliCommand?: (options: {
73
- program: Command;
74
- }) => Promise<void>;
75
- cliHandlers?: {
76
- encrypt?: DotsecCliPluginEncryptHandler<T["cliHandlersOptions"] extends {
77
- encrypt: Record<string, unknown>;
78
- } ? T["cliHandlersOptions"]["encrypt"] : Record<string, unknown>>;
79
- decrypt?: DotsecCliPluginDecryptHandler<T["cliHandlersOptions"] extends {
80
- decrypt: Record<string, unknown>;
81
- } ? T["cliHandlersOptions"]["decrypt"] : Record<string, unknown>>;
82
- run?: DotsecCliPluginRunHandler<T["cliHandlersOptions"] extends {
83
- run: Record<string, unknown>;
84
- } ? T["cliHandlersOptions"]["run"] : Record<string, unknown>>;
85
- push?: DotsecCliPluginPushHandler<T["cliHandlersOptions"] extends {
86
- push: Record<string, unknown>;
87
- } ? T["cliHandlersOptions"]["push"] : Record<string, unknown>>;
88
- };
89
- }>;
90
- type DotsecPlugin<T extends {
91
- [key: string]: DotsecPluginConfig;
92
- } = {
93
- [key: string]: DotsecPluginConfig;
94
- }> = T;
95
-
96
- type DotsecConfig<T extends DotsecPlugins = DotsecPlugins> = {
97
- defaults?: {
98
- encryptionEngine?: keyof T["plugins"] | string;
99
- plugins?: {
100
- [PluginKey in keyof T["plugins"]]?: {
101
- module?: T["plugins"][PluginKey]["module"];
102
- } & T["plugins"][PluginKey]["config"];
103
- };
104
- options?: {
105
- envFile?: string;
106
- secFile?: string;
107
- };
108
- };
109
- push?: {
110
- [key: string]: {
111
- [PluginKey in keyof T["plugins"]]?: T["plugins"][PluginKey]["push"];
112
- };
113
- };
114
- };
115
-
116
- type DotsecEncryptionEngineFactoryProps = {
117
- verbose?: boolean;
118
- };
119
- type DotsecEncryptionEngine<T = Record<string, unknown>> = {
120
- encrypt(plaintext: string): Promise<string>;
121
- decrypt(ciphertext: string): Promise<string>;
122
- } & T;
123
- type DotsecEncryptionEngineFactory<T = Record<string, unknown>, V extends Record<string, unknown> = Record<string, unknown>> = {
124
- (options: DotsecEncryptionEngineFactoryProps & T): Promise<DotsecEncryptionEngine<V>>;
125
- };
126
-
127
- type FromEnv<T extends string = string> = T | {
128
- fromEnv: string;
129
- required?: boolean;
130
- };
131
-
132
- declare const promptExecute: ({ skip, message, execute, }: {
133
- skip?: boolean | undefined;
134
- message: string;
135
- execute: () => unknown | Promise<unknown>;
136
- }) => Promise<void>;
137
-
138
- declare const resolveFromEnv: (options: {
139
- fromEnvValue?: string;
140
- env: NodeJS.ProcessEnv;
141
- variables: Record<string, string>;
142
- }) => string | undefined;
143
-
144
- declare const writeLine: (str: string) => void;
145
- declare const emphasis: (str: string) => string;
146
- declare const strong: (str: string) => string;
147
-
148
- export { DotsecConfig, DotsecEncryptionEngine, DotsecEncryptionEngineFactory, DotsecEncryptionEngineFactoryProps, DotsecPlugin, DotsecPluginModule, FromEnv, Meh, emphasis, promptExecute, resolveFromEnv, strong, writeLine };