@grantjs/cli 1.0.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/LICENSE +21 -0
- package/README.md +150 -0
- package/dist/api/client.d.ts +101 -0
- package/dist/commands/config-cmd.d.ts +2 -0
- package/dist/commands/generate-types-impl.d.ts +12 -0
- package/dist/commands/generate-types.d.ts +2 -0
- package/dist/commands/start.d.ts +2 -0
- package/dist/commands/version.d.ts +2 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/resolve-token.d.ts +9 -0
- package/dist/config/storage.d.ts +49 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +4211 -0
- package/dist/index.mjs.map +1 -0
- package/dist/types/config.d.ts +54 -0
- package/dist/utils/package.d.ts +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stored scope for the selected project (tenant + id).
|
|
3
|
+
* Used by generate-types and displayed after setup.
|
|
4
|
+
*/
|
|
5
|
+
export interface GrantScope {
|
|
6
|
+
tenant: string;
|
|
7
|
+
id: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Session: only tokens are stored (no credentials like email/password).
|
|
11
|
+
* Session auth does not auto-refresh; when the access token expires, run "grant start" again.
|
|
12
|
+
*/
|
|
13
|
+
export interface SessionCredentials {
|
|
14
|
+
token: string;
|
|
15
|
+
refreshToken?: string;
|
|
16
|
+
expiresAt?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* API key credentials (clientId + clientSecret, scope).
|
|
20
|
+
* Token is obtained by exchanging at runtime; we store key material.
|
|
21
|
+
*/
|
|
22
|
+
export interface ApiKeyCredentials {
|
|
23
|
+
clientId: string;
|
|
24
|
+
clientSecret: string;
|
|
25
|
+
scope: GrantScope;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Per-profile config (one project / API context).
|
|
29
|
+
* Secrets (token, clientSecret) are stored in the same file with strict file permissions (0o600).
|
|
30
|
+
*/
|
|
31
|
+
export interface GrantConfig {
|
|
32
|
+
apiUrl: string;
|
|
33
|
+
authMethod: 'session' | 'api-key';
|
|
34
|
+
/** Present when authMethod is session */
|
|
35
|
+
session?: SessionCredentials;
|
|
36
|
+
/** Present when authMethod is api-key */
|
|
37
|
+
apiKey?: ApiKeyCredentials;
|
|
38
|
+
/** Selected project scope (for generate-types). Set after start flow. */
|
|
39
|
+
selectedScope?: GrantScope;
|
|
40
|
+
/** Default output path for generate-types (e.g. ./src/grant-types.ts). Optional. */
|
|
41
|
+
generateTypesOutputPath?: string;
|
|
42
|
+
}
|
|
43
|
+
/** Name of a profile (key in profiles). */
|
|
44
|
+
export type ProfileName = string;
|
|
45
|
+
/**
|
|
46
|
+
* Config file: multiple profiles and a default.
|
|
47
|
+
* First profile configured becomes default unless set otherwise.
|
|
48
|
+
*/
|
|
49
|
+
export interface GrantConfigFile {
|
|
50
|
+
/** Which profile to use when --profile is not passed. */
|
|
51
|
+
defaultProfile: ProfileName;
|
|
52
|
+
/** Named profiles (e.g. "default", "staging", "client-x"). */
|
|
53
|
+
profiles: Record<ProfileName, GrantConfig>;
|
|
54
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getPackageVersion(): string;
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@grantjs/cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Grant CLI - Setup, authentication, and typings generation for @grantjs/server",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"grant": "./dist/index.mjs"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.mjs"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"keywords": [
|
|
24
|
+
"grant",
|
|
25
|
+
"cli",
|
|
26
|
+
"authorization",
|
|
27
|
+
"setup",
|
|
28
|
+
"typings",
|
|
29
|
+
"api-key"
|
|
30
|
+
],
|
|
31
|
+
"author": {
|
|
32
|
+
"name": "Alejandro Heredia",
|
|
33
|
+
"email": "ale@logus.graphics",
|
|
34
|
+
"url": "https://logus.graphics"
|
|
35
|
+
},
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "https://github.com/logusgraphics/grant.git",
|
|
39
|
+
"directory": "packages/@grantjs/cli"
|
|
40
|
+
},
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public",
|
|
44
|
+
"registry": "https://registry.npmjs.org/"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"commander": "^12.1.0",
|
|
48
|
+
"inquirer": "^13.2.2"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/inquirer": "^9.0.7",
|
|
52
|
+
"@types/node": "^24.7.2",
|
|
53
|
+
"eslint": "^9.37.0",
|
|
54
|
+
"typescript": "^5",
|
|
55
|
+
"vite": "^6.0.0",
|
|
56
|
+
"vite-plugin-dts": "^4.3.0",
|
|
57
|
+
"vitest": "^2.1.0"
|
|
58
|
+
},
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": ">=18.0.0"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build": "vite build",
|
|
64
|
+
"build:watch": "vite build --watch",
|
|
65
|
+
"type-check": "tsc --noEmit",
|
|
66
|
+
"lint": "eslint src --ext .ts",
|
|
67
|
+
"lint:fix": "eslint src --ext .ts --fix",
|
|
68
|
+
"test": "vitest",
|
|
69
|
+
"test:run": "vitest run",
|
|
70
|
+
"test:watch": "vitest",
|
|
71
|
+
"clean": "rm -rf dist"
|
|
72
|
+
}
|
|
73
|
+
}
|