@eide/foir-cli 0.1.25 → 0.1.26
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/cli.js +0 -0
- package/dist/commands/extensions.d.ts.map +1 -1
- package/dist/commands/extensions.js +7 -1
- package/dist/lib/config-loader.d.ts +28 -0
- package/dist/lib/config-loader.d.ts.map +1 -0
- package/dist/lib/config-loader.js +49 -0
- package/dist/lib/extension-helpers.d.ts +84 -0
- package/dist/lib/extension-helpers.d.ts.map +1 -0
- package/dist/lib/extension-helpers.js +89 -0
- package/dist/lib/input.d.ts +2 -0
- package/dist/lib/input.d.ts.map +1 -1
- package/dist/lib/input.js +5 -3
- package/package.json +21 -19
package/dist/cli.js
CHANGED
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../src/commands/extensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AActD,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,
|
|
1
|
+
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../src/commands/extensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AActD,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,CAkKN"}
|
|
@@ -78,8 +78,14 @@ export function registerExtensionsCommands(program, globalOpts) {
|
|
|
78
78
|
.command('install')
|
|
79
79
|
.description('Install (or update) an extension with full provisioning')
|
|
80
80
|
.option('-d, --data <json>', 'Extension manifest as JSON')
|
|
81
|
-
.option('-f, --file <path>', 'Read manifest from
|
|
81
|
+
.option('-f, --file <path>', 'Read manifest from file (.ts, .js, or .json)')
|
|
82
82
|
.option('-k, --key <key>', 'Extension key (overrides manifest)')
|
|
83
|
+
.addHelpText('after', `
|
|
84
|
+
Examples:
|
|
85
|
+
$ foir extensions install -f install.config.ts
|
|
86
|
+
$ foir extensions install -f install.json
|
|
87
|
+
$ foir extensions install -d '{"key":"my-ext","name":"My Extension",...}'
|
|
88
|
+
`)
|
|
83
89
|
.action(withErrorHandler(globalOpts, async (cmdOpts) => {
|
|
84
90
|
const opts = globalOpts();
|
|
85
91
|
const client = await createClient(opts);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration file loader.
|
|
3
|
+
*
|
|
4
|
+
* Supports loading TypeScript (.ts), JavaScript (.js, .mjs), and JSON (.json) config files.
|
|
5
|
+
* Uses dynamic imports for TypeScript/JavaScript and JSON.parse for JSON files.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Load a configuration file from disk.
|
|
9
|
+
*
|
|
10
|
+
* Supports:
|
|
11
|
+
* - TypeScript (.ts) - via dynamic import
|
|
12
|
+
* - JavaScript (.js, .mjs) - via dynamic import
|
|
13
|
+
* - JSON (.json) - via JSON.parse
|
|
14
|
+
*
|
|
15
|
+
* @param filePath - Path to the config file
|
|
16
|
+
* @returns The default export from the config file
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* // Load TypeScript config
|
|
21
|
+
* const config = await loadConfig('./install.config.ts');
|
|
22
|
+
*
|
|
23
|
+
* // Load JSON config (backward compatible)
|
|
24
|
+
* const config = await loadConfig('./install.json');
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function loadConfig<T = unknown>(filePath: string): Promise<T>;
|
|
28
|
+
//# sourceMappingURL=config-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../src/lib/config-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,UAAU,CAAC,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAyB1E"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration file loader.
|
|
3
|
+
*
|
|
4
|
+
* Supports loading TypeScript (.ts), JavaScript (.js, .mjs), and JSON (.json) config files.
|
|
5
|
+
* Uses dynamic imports for TypeScript/JavaScript and JSON.parse for JSON files.
|
|
6
|
+
*/
|
|
7
|
+
import { readFile } from 'fs/promises';
|
|
8
|
+
import { pathToFileURL } from 'url';
|
|
9
|
+
import { resolve } from 'path';
|
|
10
|
+
/**
|
|
11
|
+
* Load a configuration file from disk.
|
|
12
|
+
*
|
|
13
|
+
* Supports:
|
|
14
|
+
* - TypeScript (.ts) - via dynamic import
|
|
15
|
+
* - JavaScript (.js, .mjs) - via dynamic import
|
|
16
|
+
* - JSON (.json) - via JSON.parse
|
|
17
|
+
*
|
|
18
|
+
* @param filePath - Path to the config file
|
|
19
|
+
* @returns The default export from the config file
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* // Load TypeScript config
|
|
24
|
+
* const config = await loadConfig('./install.config.ts');
|
|
25
|
+
*
|
|
26
|
+
* // Load JSON config (backward compatible)
|
|
27
|
+
* const config = await loadConfig('./install.json');
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export async function loadConfig(filePath) {
|
|
31
|
+
const absPath = resolve(filePath);
|
|
32
|
+
// TypeScript files (requires tsx or ts-node in user's environment)
|
|
33
|
+
if (filePath.endsWith('.ts')) {
|
|
34
|
+
const configModule = await import(pathToFileURL(absPath).href);
|
|
35
|
+
return configModule.default;
|
|
36
|
+
}
|
|
37
|
+
// JavaScript files
|
|
38
|
+
if (filePath.endsWith('.js') || filePath.endsWith('.mjs')) {
|
|
39
|
+
const configModule = await import(pathToFileURL(absPath).href);
|
|
40
|
+
return configModule.default;
|
|
41
|
+
}
|
|
42
|
+
// JSON files (backward compatible)
|
|
43
|
+
if (filePath.endsWith('.json')) {
|
|
44
|
+
const content = await readFile(absPath, 'utf-8');
|
|
45
|
+
return JSON.parse(content);
|
|
46
|
+
}
|
|
47
|
+
throw new Error(`Unsupported file extension for "${filePath}". ` +
|
|
48
|
+
`Supported: .ts, .js, .mjs, .json`);
|
|
49
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extension configuration helpers.
|
|
3
|
+
*
|
|
4
|
+
* These helpers provide type-safe configuration for extension installation
|
|
5
|
+
* using types generated from the platform's GraphQL schema.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { defineExtension } from '@eide/foir-cli/extensions';
|
|
10
|
+
*
|
|
11
|
+
* export default defineExtension({
|
|
12
|
+
* key: 'my-extension',
|
|
13
|
+
* name: 'My Extension',
|
|
14
|
+
* models: [...]
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
import type { InstallExtensionInput, InstallExtensionModelInput, FieldDefinitionInput, InstallExtensionOperationInput } from '../graphql/generated.js';
|
|
19
|
+
/**
|
|
20
|
+
* Define an extension manifest with full type safety.
|
|
21
|
+
*
|
|
22
|
+
* This is a pass-through function that provides IntelliSense and
|
|
23
|
+
* compile-time validation for extension configurations.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* export default defineExtension({
|
|
28
|
+
* key: 'my-extension',
|
|
29
|
+
* name: 'My Extension',
|
|
30
|
+
* models: [{
|
|
31
|
+
* key: 'my_model',
|
|
32
|
+
* name: 'My Model',
|
|
33
|
+
* fields: [
|
|
34
|
+
* { key: 'title', type: 'text', label: 'Title', required: true }
|
|
35
|
+
* ]
|
|
36
|
+
* }]
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function defineExtension(config: InstallExtensionInput): InstallExtensionInput;
|
|
41
|
+
/**
|
|
42
|
+
* Define a model with type-safe field definitions.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const myModel = defineModel({
|
|
47
|
+
* key: 'my_model',
|
|
48
|
+
* name: 'My Model',
|
|
49
|
+
* fields: [
|
|
50
|
+
* { key: 'title', type: 'text', label: 'Title', required: true }
|
|
51
|
+
* ]
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function defineModel(model: InstallExtensionModelInput): InstallExtensionModelInput;
|
|
56
|
+
/**
|
|
57
|
+
* Define a field with type safety.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* const titleField = defineField({
|
|
62
|
+
* key: 'title',
|
|
63
|
+
* type: 'text',
|
|
64
|
+
* label: 'Title',
|
|
65
|
+
* required: true
|
|
66
|
+
* });
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export declare function defineField(field: FieldDefinitionInput): FieldDefinitionInput;
|
|
70
|
+
/**
|
|
71
|
+
* Define an operation with type safety.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const myOperation = defineOperation({
|
|
76
|
+
* key: 'my-operation',
|
|
77
|
+
* name: 'My Operation',
|
|
78
|
+
* endpoint: '/operations/my-operation'
|
|
79
|
+
* });
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export declare function defineOperation(operation: InstallExtensionOperationInput): InstallExtensionOperationInput;
|
|
83
|
+
export type { InstallExtensionInput, InstallExtensionModelInput, FieldDefinitionInput, InstallExtensionOperationInput, InstallExtensionAuthProviderInput, InstallExtensionPlacementInput, InstallExtensionCustomerProfileSchemaInput, } from '../graphql/generated.js';
|
|
84
|
+
//# sourceMappingURL=extension-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-helpers.d.ts","sourceRoot":"","sources":["../../src/lib/extension-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EACV,qBAAqB,EACrB,0BAA0B,EAC1B,oBAAoB,EACpB,8BAA8B,EAC/B,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,qBAAqB,GAC5B,qBAAqB,CAEvB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,0BAA0B,GAChC,0BAA0B,CAE5B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,oBAAoB,GAC1B,oBAAoB,CAEtB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,8BAA8B,GACxC,8BAA8B,CAEhC;AAGD,YAAY,EACV,qBAAqB,EACrB,0BAA0B,EAC1B,oBAAoB,EACpB,8BAA8B,EAC9B,iCAAiC,EACjC,8BAA8B,EAC9B,0CAA0C,GAC3C,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extension configuration helpers.
|
|
3
|
+
*
|
|
4
|
+
* These helpers provide type-safe configuration for extension installation
|
|
5
|
+
* using types generated from the platform's GraphQL schema.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { defineExtension } from '@eide/foir-cli/extensions';
|
|
10
|
+
*
|
|
11
|
+
* export default defineExtension({
|
|
12
|
+
* key: 'my-extension',
|
|
13
|
+
* name: 'My Extension',
|
|
14
|
+
* models: [...]
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Define an extension manifest with full type safety.
|
|
20
|
+
*
|
|
21
|
+
* This is a pass-through function that provides IntelliSense and
|
|
22
|
+
* compile-time validation for extension configurations.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* export default defineExtension({
|
|
27
|
+
* key: 'my-extension',
|
|
28
|
+
* name: 'My Extension',
|
|
29
|
+
* models: [{
|
|
30
|
+
* key: 'my_model',
|
|
31
|
+
* name: 'My Model',
|
|
32
|
+
* fields: [
|
|
33
|
+
* { key: 'title', type: 'text', label: 'Title', required: true }
|
|
34
|
+
* ]
|
|
35
|
+
* }]
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export function defineExtension(config) {
|
|
40
|
+
return config;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Define a model with type-safe field definitions.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const myModel = defineModel({
|
|
48
|
+
* key: 'my_model',
|
|
49
|
+
* name: 'My Model',
|
|
50
|
+
* fields: [
|
|
51
|
+
* { key: 'title', type: 'text', label: 'Title', required: true }
|
|
52
|
+
* ]
|
|
53
|
+
* });
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export function defineModel(model) {
|
|
57
|
+
return model;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Define a field with type safety.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const titleField = defineField({
|
|
65
|
+
* key: 'title',
|
|
66
|
+
* type: 'text',
|
|
67
|
+
* label: 'Title',
|
|
68
|
+
* required: true
|
|
69
|
+
* });
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export function defineField(field) {
|
|
73
|
+
return field;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Define an operation with type safety.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* const myOperation = defineOperation({
|
|
81
|
+
* key: 'my-operation',
|
|
82
|
+
* name: 'My Operation',
|
|
83
|
+
* endpoint: '/operations/my-operation'
|
|
84
|
+
* });
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export function defineOperation(operation) {
|
|
88
|
+
return operation;
|
|
89
|
+
}
|
package/dist/lib/input.d.ts
CHANGED
package/dist/lib/input.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/lib/input.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/lib/input.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAyBnC;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAM7C;AAED,UAAU,YAAY;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,EAAE,CA8B9D;AAWD,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAQjE;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAC3B,OAAO,CAAC,OAAO,CAAC,CAalB"}
|
package/dist/lib/input.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { promises as fs } from 'fs';
|
|
2
1
|
import inquirer from 'inquirer';
|
|
2
|
+
import { loadConfig } from './config-loader.js';
|
|
3
3
|
/**
|
|
4
4
|
* Parse input data from --data, --file, or stdin.
|
|
5
|
+
*
|
|
6
|
+
* Supports TypeScript (.ts), JavaScript (.js, .mjs), and JSON (.json) files.
|
|
5
7
|
*/
|
|
6
8
|
export async function parseInputData(opts) {
|
|
7
9
|
if (opts.data) {
|
|
8
10
|
return JSON.parse(opts.data);
|
|
9
11
|
}
|
|
10
12
|
if (opts.file) {
|
|
11
|
-
|
|
12
|
-
return
|
|
13
|
+
// Use config loader for TypeScript/JavaScript/JSON files
|
|
14
|
+
return await loadConfig(opts.file);
|
|
13
15
|
}
|
|
14
16
|
// Check for stdin pipe
|
|
15
17
|
if (!process.stdin.isTTY) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eide/foir-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.26",
|
|
4
4
|
"description": "Universal platform CLI for EIDE — scriptable, composable resource management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -17,29 +17,16 @@
|
|
|
17
17
|
"./config": {
|
|
18
18
|
"types": "./dist/config/types.js",
|
|
19
19
|
"import": "./dist/config/types.js"
|
|
20
|
+
},
|
|
21
|
+
"./extensions": {
|
|
22
|
+
"types": "./dist/lib/extension-helpers.js",
|
|
23
|
+
"import": "./dist/lib/extension-helpers.js"
|
|
20
24
|
}
|
|
21
25
|
},
|
|
22
26
|
"files": [
|
|
23
27
|
"dist",
|
|
24
28
|
"README.md"
|
|
25
29
|
],
|
|
26
|
-
"scripts": {
|
|
27
|
-
"build": "tsc",
|
|
28
|
-
"dev:cli": "tsx src/cli.ts",
|
|
29
|
-
"check-types": "tsc --noEmit",
|
|
30
|
-
"lint": "eslint src/",
|
|
31
|
-
"lint:fix": "eslint src/ --fix",
|
|
32
|
-
"test": "vitest run",
|
|
33
|
-
"test:watch": "vitest watch",
|
|
34
|
-
"codegen": "graphql-codegen --config codegen.ts",
|
|
35
|
-
"codegen:watch": "graphql-codegen --config codegen.ts --watch",
|
|
36
|
-
"prepublishOnly": "npm run build",
|
|
37
|
-
"patch": "npm run build && npm version patch",
|
|
38
|
-
"minor": "npm run build && npm version minor",
|
|
39
|
-
"major": "npm run build && npm version major",
|
|
40
|
-
"publish": "npm run build && npm publish",
|
|
41
|
-
"release": "npm run build && npm version patch && npm publish"
|
|
42
|
-
},
|
|
43
30
|
"keywords": [
|
|
44
31
|
"foir",
|
|
45
32
|
"eide",
|
|
@@ -83,5 +70,20 @@
|
|
|
83
70
|
"repository": {
|
|
84
71
|
"type": "git",
|
|
85
72
|
"url": "https://github.com/eidebuild/foir-cli.git"
|
|
73
|
+
},
|
|
74
|
+
"scripts": {
|
|
75
|
+
"build": "tsc",
|
|
76
|
+
"dev:cli": "tsx src/cli.ts",
|
|
77
|
+
"check-types": "tsc --noEmit",
|
|
78
|
+
"lint": "eslint src/",
|
|
79
|
+
"lint:fix": "eslint src/ --fix",
|
|
80
|
+
"test": "vitest run",
|
|
81
|
+
"test:watch": "vitest watch",
|
|
82
|
+
"codegen": "graphql-codegen --config codegen.ts",
|
|
83
|
+
"codegen:watch": "graphql-codegen --config codegen.ts --watch",
|
|
84
|
+
"patch": "npm run build && npm version patch",
|
|
85
|
+
"minor": "npm run build && npm version minor",
|
|
86
|
+
"major": "npm run build && npm version major",
|
|
87
|
+
"release": "npm run build && npm version patch && npm publish"
|
|
86
88
|
}
|
|
87
|
-
}
|
|
89
|
+
}
|