appstash 0.3.1 → 0.5.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/config-store.d.ts +43 -0
- package/config-store.js +213 -0
- package/esm/config-store.d.ts +43 -0
- package/esm/config-store.js +177 -0
- package/esm/index.d.ts +2 -0
- package/esm/index.js +1 -0
- package/index.d.ts +2 -0
- package/index.js +3 -0
- package/package.json +2 -2
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface ContextTargetEndpoint {
|
|
2
|
+
endpoint: string;
|
|
3
|
+
}
|
|
4
|
+
export interface ContextConfig {
|
|
5
|
+
name: string;
|
|
6
|
+
endpoint: string;
|
|
7
|
+
targets?: Record<string, ContextTargetEndpoint>;
|
|
8
|
+
createdAt: string;
|
|
9
|
+
updatedAt: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ContextCredentials {
|
|
12
|
+
token: string;
|
|
13
|
+
expiresAt?: string;
|
|
14
|
+
refreshToken?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface Credentials {
|
|
17
|
+
tokens: Record<string, ContextCredentials>;
|
|
18
|
+
}
|
|
19
|
+
export interface GlobalSettings {
|
|
20
|
+
currentContext?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ConfigStoreOptions {
|
|
23
|
+
baseDir?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ConfigStore {
|
|
26
|
+
loadSettings(): GlobalSettings;
|
|
27
|
+
saveSettings(settings: GlobalSettings): void;
|
|
28
|
+
createContext(name: string, options: {
|
|
29
|
+
endpoint: string;
|
|
30
|
+
targets?: Record<string, ContextTargetEndpoint>;
|
|
31
|
+
}): ContextConfig;
|
|
32
|
+
loadContext(name: string): ContextConfig | null;
|
|
33
|
+
listContexts(): ContextConfig[];
|
|
34
|
+
deleteContext(name: string): boolean;
|
|
35
|
+
getCurrentContext(): ContextConfig | null;
|
|
36
|
+
setCurrentContext(name: string): boolean;
|
|
37
|
+
getTargetEndpoint(targetName: string, contextName?: string): string | null;
|
|
38
|
+
setCredentials(contextName: string, creds: ContextCredentials): void;
|
|
39
|
+
getCredentials(contextName: string): ContextCredentials | null;
|
|
40
|
+
removeCredentials(contextName: string): boolean;
|
|
41
|
+
hasValidCredentials(contextName: string): boolean;
|
|
42
|
+
}
|
|
43
|
+
export declare function createConfigStore(toolName: string, options?: ConfigStoreOptions): ConfigStore;
|
package/config-store.js
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.createConfigStore = createConfigStore;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const index_1 = require("./index");
|
|
40
|
+
const DEFAULT_SETTINGS = {};
|
|
41
|
+
function readJson(filePath, fallback) {
|
|
42
|
+
if (fs.existsSync(filePath)) {
|
|
43
|
+
try {
|
|
44
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return fallback;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return fallback;
|
|
51
|
+
}
|
|
52
|
+
function writeJson(filePath, data, mode) {
|
|
53
|
+
const dir = path.dirname(filePath);
|
|
54
|
+
if (!fs.existsSync(dir)) {
|
|
55
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
56
|
+
}
|
|
57
|
+
const options = mode ? { mode } : {};
|
|
58
|
+
fs.writeFileSync(filePath, JSON.stringify(data, null, 2), options);
|
|
59
|
+
}
|
|
60
|
+
function createConfigStore(toolName, options) {
|
|
61
|
+
const dirs = (0, index_1.appstash)(toolName, { ensure: true, baseDir: options?.baseDir });
|
|
62
|
+
function settingsPath() {
|
|
63
|
+
return (0, index_1.resolve)(dirs, 'config', 'settings.json');
|
|
64
|
+
}
|
|
65
|
+
function credentialsPath() {
|
|
66
|
+
return (0, index_1.resolve)(dirs, 'config', 'credentials.json');
|
|
67
|
+
}
|
|
68
|
+
function contextPath(name) {
|
|
69
|
+
const contextsDir = (0, index_1.resolve)(dirs, 'config', 'contexts');
|
|
70
|
+
if (!fs.existsSync(contextsDir)) {
|
|
71
|
+
fs.mkdirSync(contextsDir, { recursive: true });
|
|
72
|
+
}
|
|
73
|
+
return path.join(contextsDir, `${name}.json`);
|
|
74
|
+
}
|
|
75
|
+
function loadSettings() {
|
|
76
|
+
return readJson(settingsPath(), DEFAULT_SETTINGS);
|
|
77
|
+
}
|
|
78
|
+
function saveSettings(settings) {
|
|
79
|
+
writeJson(settingsPath(), settings);
|
|
80
|
+
}
|
|
81
|
+
function loadContext(name) {
|
|
82
|
+
return readJson(contextPath(name), null);
|
|
83
|
+
}
|
|
84
|
+
function createContext(name, options) {
|
|
85
|
+
const now = new Date().toISOString();
|
|
86
|
+
const context = {
|
|
87
|
+
name,
|
|
88
|
+
endpoint: options.endpoint,
|
|
89
|
+
createdAt: now,
|
|
90
|
+
updatedAt: now,
|
|
91
|
+
};
|
|
92
|
+
if (options.targets) {
|
|
93
|
+
context.targets = options.targets;
|
|
94
|
+
}
|
|
95
|
+
writeJson(contextPath(name), context);
|
|
96
|
+
return context;
|
|
97
|
+
}
|
|
98
|
+
function listContexts() {
|
|
99
|
+
const contextsDir = (0, index_1.resolve)(dirs, 'config', 'contexts');
|
|
100
|
+
if (!fs.existsSync(contextsDir)) {
|
|
101
|
+
return [];
|
|
102
|
+
}
|
|
103
|
+
const files = fs.readdirSync(contextsDir).filter(f => f.endsWith('.json'));
|
|
104
|
+
const contexts = [];
|
|
105
|
+
for (const file of files) {
|
|
106
|
+
try {
|
|
107
|
+
const content = fs.readFileSync(path.join(contextsDir, file), 'utf8');
|
|
108
|
+
contexts.push(JSON.parse(content));
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
// skip invalid files
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return contexts;
|
|
115
|
+
}
|
|
116
|
+
function deleteContext(name) {
|
|
117
|
+
const p = contextPath(name);
|
|
118
|
+
if (fs.existsSync(p)) {
|
|
119
|
+
fs.unlinkSync(p);
|
|
120
|
+
const settings = loadSettings();
|
|
121
|
+
if (settings.currentContext === name) {
|
|
122
|
+
settings.currentContext = undefined;
|
|
123
|
+
saveSettings(settings);
|
|
124
|
+
}
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
function getCurrentContext() {
|
|
130
|
+
const settings = loadSettings();
|
|
131
|
+
if (settings.currentContext) {
|
|
132
|
+
return loadContext(settings.currentContext);
|
|
133
|
+
}
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
function setCurrentContext(name) {
|
|
137
|
+
const context = loadContext(name);
|
|
138
|
+
if (!context) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
const settings = loadSettings();
|
|
142
|
+
settings.currentContext = name;
|
|
143
|
+
saveSettings(settings);
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
function loadCredentials() {
|
|
147
|
+
return readJson(credentialsPath(), { tokens: {} });
|
|
148
|
+
}
|
|
149
|
+
function saveCredentials(credentials) {
|
|
150
|
+
writeJson(credentialsPath(), credentials, 0o600);
|
|
151
|
+
}
|
|
152
|
+
function setCredentials(contextName, creds) {
|
|
153
|
+
const credentials = loadCredentials();
|
|
154
|
+
credentials.tokens[contextName] = creds;
|
|
155
|
+
saveCredentials(credentials);
|
|
156
|
+
}
|
|
157
|
+
function getCredentials(contextName) {
|
|
158
|
+
const credentials = loadCredentials();
|
|
159
|
+
return credentials.tokens[contextName] || null;
|
|
160
|
+
}
|
|
161
|
+
function removeCredentials(contextName) {
|
|
162
|
+
const credentials = loadCredentials();
|
|
163
|
+
if (credentials.tokens[contextName]) {
|
|
164
|
+
delete credentials.tokens[contextName];
|
|
165
|
+
saveCredentials(credentials);
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
function hasValidCredentials(contextName) {
|
|
171
|
+
const creds = getCredentials(contextName);
|
|
172
|
+
if (!creds || !creds.token) {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
if (creds.expiresAt) {
|
|
176
|
+
const expiresAt = new Date(creds.expiresAt);
|
|
177
|
+
if (expiresAt <= new Date()) {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
function getTargetEndpoint(targetName, contextName) {
|
|
184
|
+
let ctx;
|
|
185
|
+
if (contextName) {
|
|
186
|
+
ctx = loadContext(contextName);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
ctx = getCurrentContext();
|
|
190
|
+
}
|
|
191
|
+
if (!ctx)
|
|
192
|
+
return null;
|
|
193
|
+
if (ctx.targets && ctx.targets[targetName]) {
|
|
194
|
+
return ctx.targets[targetName].endpoint;
|
|
195
|
+
}
|
|
196
|
+
return ctx.endpoint;
|
|
197
|
+
}
|
|
198
|
+
return {
|
|
199
|
+
loadSettings,
|
|
200
|
+
saveSettings,
|
|
201
|
+
createContext,
|
|
202
|
+
loadContext,
|
|
203
|
+
listContexts,
|
|
204
|
+
deleteContext,
|
|
205
|
+
getCurrentContext,
|
|
206
|
+
setCurrentContext,
|
|
207
|
+
getTargetEndpoint,
|
|
208
|
+
setCredentials,
|
|
209
|
+
getCredentials,
|
|
210
|
+
removeCredentials,
|
|
211
|
+
hasValidCredentials,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface ContextTargetEndpoint {
|
|
2
|
+
endpoint: string;
|
|
3
|
+
}
|
|
4
|
+
export interface ContextConfig {
|
|
5
|
+
name: string;
|
|
6
|
+
endpoint: string;
|
|
7
|
+
targets?: Record<string, ContextTargetEndpoint>;
|
|
8
|
+
createdAt: string;
|
|
9
|
+
updatedAt: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ContextCredentials {
|
|
12
|
+
token: string;
|
|
13
|
+
expiresAt?: string;
|
|
14
|
+
refreshToken?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface Credentials {
|
|
17
|
+
tokens: Record<string, ContextCredentials>;
|
|
18
|
+
}
|
|
19
|
+
export interface GlobalSettings {
|
|
20
|
+
currentContext?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ConfigStoreOptions {
|
|
23
|
+
baseDir?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ConfigStore {
|
|
26
|
+
loadSettings(): GlobalSettings;
|
|
27
|
+
saveSettings(settings: GlobalSettings): void;
|
|
28
|
+
createContext(name: string, options: {
|
|
29
|
+
endpoint: string;
|
|
30
|
+
targets?: Record<string, ContextTargetEndpoint>;
|
|
31
|
+
}): ContextConfig;
|
|
32
|
+
loadContext(name: string): ContextConfig | null;
|
|
33
|
+
listContexts(): ContextConfig[];
|
|
34
|
+
deleteContext(name: string): boolean;
|
|
35
|
+
getCurrentContext(): ContextConfig | null;
|
|
36
|
+
setCurrentContext(name: string): boolean;
|
|
37
|
+
getTargetEndpoint(targetName: string, contextName?: string): string | null;
|
|
38
|
+
setCredentials(contextName: string, creds: ContextCredentials): void;
|
|
39
|
+
getCredentials(contextName: string): ContextCredentials | null;
|
|
40
|
+
removeCredentials(contextName: string): boolean;
|
|
41
|
+
hasValidCredentials(contextName: string): boolean;
|
|
42
|
+
}
|
|
43
|
+
export declare function createConfigStore(toolName: string, options?: ConfigStoreOptions): ConfigStore;
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import { appstash, resolve } from './index';
|
|
4
|
+
const DEFAULT_SETTINGS = {};
|
|
5
|
+
function readJson(filePath, fallback) {
|
|
6
|
+
if (fs.existsSync(filePath)) {
|
|
7
|
+
try {
|
|
8
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return fallback;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return fallback;
|
|
15
|
+
}
|
|
16
|
+
function writeJson(filePath, data, mode) {
|
|
17
|
+
const dir = path.dirname(filePath);
|
|
18
|
+
if (!fs.existsSync(dir)) {
|
|
19
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
20
|
+
}
|
|
21
|
+
const options = mode ? { mode } : {};
|
|
22
|
+
fs.writeFileSync(filePath, JSON.stringify(data, null, 2), options);
|
|
23
|
+
}
|
|
24
|
+
export function createConfigStore(toolName, options) {
|
|
25
|
+
const dirs = appstash(toolName, { ensure: true, baseDir: options?.baseDir });
|
|
26
|
+
function settingsPath() {
|
|
27
|
+
return resolve(dirs, 'config', 'settings.json');
|
|
28
|
+
}
|
|
29
|
+
function credentialsPath() {
|
|
30
|
+
return resolve(dirs, 'config', 'credentials.json');
|
|
31
|
+
}
|
|
32
|
+
function contextPath(name) {
|
|
33
|
+
const contextsDir = resolve(dirs, 'config', 'contexts');
|
|
34
|
+
if (!fs.existsSync(contextsDir)) {
|
|
35
|
+
fs.mkdirSync(contextsDir, { recursive: true });
|
|
36
|
+
}
|
|
37
|
+
return path.join(contextsDir, `${name}.json`);
|
|
38
|
+
}
|
|
39
|
+
function loadSettings() {
|
|
40
|
+
return readJson(settingsPath(), DEFAULT_SETTINGS);
|
|
41
|
+
}
|
|
42
|
+
function saveSettings(settings) {
|
|
43
|
+
writeJson(settingsPath(), settings);
|
|
44
|
+
}
|
|
45
|
+
function loadContext(name) {
|
|
46
|
+
return readJson(contextPath(name), null);
|
|
47
|
+
}
|
|
48
|
+
function createContext(name, options) {
|
|
49
|
+
const now = new Date().toISOString();
|
|
50
|
+
const context = {
|
|
51
|
+
name,
|
|
52
|
+
endpoint: options.endpoint,
|
|
53
|
+
createdAt: now,
|
|
54
|
+
updatedAt: now,
|
|
55
|
+
};
|
|
56
|
+
if (options.targets) {
|
|
57
|
+
context.targets = options.targets;
|
|
58
|
+
}
|
|
59
|
+
writeJson(contextPath(name), context);
|
|
60
|
+
return context;
|
|
61
|
+
}
|
|
62
|
+
function listContexts() {
|
|
63
|
+
const contextsDir = resolve(dirs, 'config', 'contexts');
|
|
64
|
+
if (!fs.existsSync(contextsDir)) {
|
|
65
|
+
return [];
|
|
66
|
+
}
|
|
67
|
+
const files = fs.readdirSync(contextsDir).filter(f => f.endsWith('.json'));
|
|
68
|
+
const contexts = [];
|
|
69
|
+
for (const file of files) {
|
|
70
|
+
try {
|
|
71
|
+
const content = fs.readFileSync(path.join(contextsDir, file), 'utf8');
|
|
72
|
+
contexts.push(JSON.parse(content));
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// skip invalid files
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return contexts;
|
|
79
|
+
}
|
|
80
|
+
function deleteContext(name) {
|
|
81
|
+
const p = contextPath(name);
|
|
82
|
+
if (fs.existsSync(p)) {
|
|
83
|
+
fs.unlinkSync(p);
|
|
84
|
+
const settings = loadSettings();
|
|
85
|
+
if (settings.currentContext === name) {
|
|
86
|
+
settings.currentContext = undefined;
|
|
87
|
+
saveSettings(settings);
|
|
88
|
+
}
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
function getCurrentContext() {
|
|
94
|
+
const settings = loadSettings();
|
|
95
|
+
if (settings.currentContext) {
|
|
96
|
+
return loadContext(settings.currentContext);
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
function setCurrentContext(name) {
|
|
101
|
+
const context = loadContext(name);
|
|
102
|
+
if (!context) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
const settings = loadSettings();
|
|
106
|
+
settings.currentContext = name;
|
|
107
|
+
saveSettings(settings);
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
function loadCredentials() {
|
|
111
|
+
return readJson(credentialsPath(), { tokens: {} });
|
|
112
|
+
}
|
|
113
|
+
function saveCredentials(credentials) {
|
|
114
|
+
writeJson(credentialsPath(), credentials, 0o600);
|
|
115
|
+
}
|
|
116
|
+
function setCredentials(contextName, creds) {
|
|
117
|
+
const credentials = loadCredentials();
|
|
118
|
+
credentials.tokens[contextName] = creds;
|
|
119
|
+
saveCredentials(credentials);
|
|
120
|
+
}
|
|
121
|
+
function getCredentials(contextName) {
|
|
122
|
+
const credentials = loadCredentials();
|
|
123
|
+
return credentials.tokens[contextName] || null;
|
|
124
|
+
}
|
|
125
|
+
function removeCredentials(contextName) {
|
|
126
|
+
const credentials = loadCredentials();
|
|
127
|
+
if (credentials.tokens[contextName]) {
|
|
128
|
+
delete credentials.tokens[contextName];
|
|
129
|
+
saveCredentials(credentials);
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
function hasValidCredentials(contextName) {
|
|
135
|
+
const creds = getCredentials(contextName);
|
|
136
|
+
if (!creds || !creds.token) {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
if (creds.expiresAt) {
|
|
140
|
+
const expiresAt = new Date(creds.expiresAt);
|
|
141
|
+
if (expiresAt <= new Date()) {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
function getTargetEndpoint(targetName, contextName) {
|
|
148
|
+
let ctx;
|
|
149
|
+
if (contextName) {
|
|
150
|
+
ctx = loadContext(contextName);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
ctx = getCurrentContext();
|
|
154
|
+
}
|
|
155
|
+
if (!ctx)
|
|
156
|
+
return null;
|
|
157
|
+
if (ctx.targets && ctx.targets[targetName]) {
|
|
158
|
+
return ctx.targets[targetName].endpoint;
|
|
159
|
+
}
|
|
160
|
+
return ctx.endpoint;
|
|
161
|
+
}
|
|
162
|
+
return {
|
|
163
|
+
loadSettings,
|
|
164
|
+
saveSettings,
|
|
165
|
+
createContext,
|
|
166
|
+
loadContext,
|
|
167
|
+
listContexts,
|
|
168
|
+
deleteContext,
|
|
169
|
+
getCurrentContext,
|
|
170
|
+
setCurrentContext,
|
|
171
|
+
getTargetEndpoint,
|
|
172
|
+
setCredentials,
|
|
173
|
+
getCredentials,
|
|
174
|
+
removeCredentials,
|
|
175
|
+
hasValidCredentials,
|
|
176
|
+
};
|
|
177
|
+
}
|
package/esm/index.d.ts
CHANGED
|
@@ -97,3 +97,5 @@ export declare function ensure(dirs: AppStashResult): EnsureResult;
|
|
|
97
97
|
* ```
|
|
98
98
|
*/
|
|
99
99
|
export declare function resolve(dirs: AppStashResult, kind: 'config' | 'cache' | 'data' | 'logs' | 'tmp', ...parts: string[]): string;
|
|
100
|
+
export { createConfigStore } from './config-store';
|
|
101
|
+
export type { ConfigStore, ConfigStoreOptions, ContextConfig, ContextCredentials, ContextTargetEndpoint, Credentials, GlobalSettings, } from './config-store';
|
package/esm/index.js
CHANGED
package/index.d.ts
CHANGED
|
@@ -97,3 +97,5 @@ export declare function ensure(dirs: AppStashResult): EnsureResult;
|
|
|
97
97
|
* ```
|
|
98
98
|
*/
|
|
99
99
|
export declare function resolve(dirs: AppStashResult, kind: 'config' | 'cache' | 'data' | 'logs' | 'tmp', ...parts: string[]): string;
|
|
100
|
+
export { createConfigStore } from './config-store';
|
|
101
|
+
export type { ConfigStore, ConfigStoreOptions, ContextConfig, ContextCredentials, ContextTargetEndpoint, Credentials, GlobalSettings, } from './config-store';
|
package/index.js
CHANGED
|
@@ -33,6 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.createConfigStore = void 0;
|
|
36
37
|
exports.appstash = appstash;
|
|
37
38
|
exports.ensure = ensure;
|
|
38
39
|
exports.resolve = resolve;
|
|
@@ -239,3 +240,5 @@ function ensureDirectories(dirs, useXdgFallback = true, tmpRoot = os.tmpdir(), t
|
|
|
239
240
|
function resolve(dirs, kind, ...parts) {
|
|
240
241
|
return path.join(dirs[kind], ...parts);
|
|
241
242
|
}
|
|
243
|
+
var config_store_1 = require("./config-store");
|
|
244
|
+
Object.defineProperty(exports, "createConfigStore", { enumerable: true, get: function () { return config_store_1.createConfigStore; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appstash",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "Simple, clean application directory resolution",
|
|
6
6
|
"main": "index.js",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"xdg",
|
|
41
41
|
"appdirs"
|
|
42
42
|
],
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "fd9721cb17389c4e2f9847169d5a42de2f9746dd"
|
|
44
44
|
}
|