@eide/foir-cli 0.1.34 → 0.1.36
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 +7469 -81
- package/dist/config/types.d.ts +7 -6
- package/dist/config/types.js +6 -14
- package/dist/generated-CPsQ9jfu.d.ts +195 -0
- package/dist/lib/extension-helpers.d.ts +10 -7
- package/dist/lib/extension-helpers.js +15 -85
- package/dist/lib/hook-helpers.d.ts +9 -6
- package/dist/lib/hook-helpers.js +12 -105
- package/dist/lib/seed-helpers.d.ts +10 -8
- package/dist/lib/seed-helpers.js +18 -124
- package/package.json +9 -7
- package/dist/auth/credentials.d.ts +0 -31
- package/dist/auth/credentials.d.ts.map +0 -1
- package/dist/auth/credentials.js +0 -139
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/codegen/fetch-customer-profile-schema.d.ts +0 -12
- package/dist/codegen/fetch-customer-profile-schema.d.ts.map +0 -1
- package/dist/codegen/fetch-customer-profile-schema.js +0 -21
- package/dist/codegen/fetch-models.d.ts +0 -58
- package/dist/codegen/fetch-models.d.ts.map +0 -1
- package/dist/codegen/fetch-models.js +0 -96
- package/dist/codegen/field-mapping.d.ts +0 -34
- package/dist/codegen/field-mapping.d.ts.map +0 -1
- package/dist/codegen/field-mapping.js +0 -250
- package/dist/codegen/generators/config.d.ts +0 -5
- package/dist/codegen/generators/config.d.ts.map +0 -1
- package/dist/codegen/generators/config.js +0 -82
- package/dist/codegen/generators/customer-profile-documents.d.ts +0 -5
- package/dist/codegen/generators/customer-profile-documents.d.ts.map +0 -1
- package/dist/codegen/generators/customer-profile-documents.js +0 -42
- package/dist/codegen/generators/customer-profile-hooks.d.ts +0 -5
- package/dist/codegen/generators/customer-profile-hooks.d.ts.map +0 -1
- package/dist/codegen/generators/customer-profile-hooks.js +0 -78
- package/dist/codegen/generators/customer-profile-loaders.d.ts +0 -5
- package/dist/codegen/generators/customer-profile-loaders.d.ts.map +0 -1
- package/dist/codegen/generators/customer-profile-loaders.js +0 -67
- package/dist/codegen/generators/customer-profile-operations.d.ts +0 -5
- package/dist/codegen/generators/customer-profile-operations.d.ts.map +0 -1
- package/dist/codegen/generators/customer-profile-operations.js +0 -126
- package/dist/codegen/generators/customer-profile-types.d.ts +0 -6
- package/dist/codegen/generators/customer-profile-types.d.ts.map +0 -1
- package/dist/codegen/generators/customer-profile-types.js +0 -45
- package/dist/codegen/generators/documents.d.ts +0 -12
- package/dist/codegen/generators/documents.d.ts.map +0 -1
- package/dist/codegen/generators/documents.js +0 -178
- package/dist/codegen/generators/field-types.d.ts +0 -5
- package/dist/codegen/generators/field-types.d.ts.map +0 -1
- package/dist/codegen/generators/field-types.js +0 -346
- package/dist/codegen/generators/model-index.d.ts +0 -6
- package/dist/codegen/generators/model-index.d.ts.map +0 -1
- package/dist/codegen/generators/model-index.js +0 -26
- package/dist/codegen/generators/model-types.d.ts +0 -12
- package/dist/codegen/generators/model-types.d.ts.map +0 -1
- package/dist/codegen/generators/model-types.js +0 -176
- package/dist/codegen/generators/public-schema-content.d.ts +0 -14
- package/dist/codegen/generators/public-schema-content.d.ts.map +0 -1
- package/dist/codegen/generators/public-schema-content.js +0 -22
- package/dist/codegen/generators/react-hooks-index.d.ts +0 -6
- package/dist/codegen/generators/react-hooks-index.d.ts.map +0 -1
- package/dist/codegen/generators/react-hooks-index.js +0 -20
- package/dist/codegen/generators/react-hooks.d.ts +0 -7
- package/dist/codegen/generators/react-hooks.d.ts.map +0 -1
- package/dist/codegen/generators/react-hooks.js +0 -139
- package/dist/codegen/generators/remix-loaders-index.d.ts +0 -6
- package/dist/codegen/generators/remix-loaders-index.d.ts.map +0 -1
- package/dist/codegen/generators/remix-loaders-index.js +0 -20
- package/dist/codegen/generators/remix-loaders.d.ts +0 -7
- package/dist/codegen/generators/remix-loaders.d.ts.map +0 -1
- package/dist/codegen/generators/remix-loaders.js +0 -107
- package/dist/codegen/generators/static-documents.d.ts +0 -14
- package/dist/codegen/generators/static-documents.d.ts.map +0 -1
- package/dist/codegen/generators/static-documents.js +0 -771
- package/dist/codegen/generators/swift-customer-profile.d.ts +0 -9
- package/dist/codegen/generators/swift-customer-profile.d.ts.map +0 -1
- package/dist/codegen/generators/swift-customer-profile.js +0 -152
- package/dist/codegen/generators/swift-field-types.d.ts +0 -5
- package/dist/codegen/generators/swift-field-types.d.ts.map +0 -1
- package/dist/codegen/generators/swift-field-types.js +0 -151
- package/dist/codegen/generators/swift-model-keys.d.ts +0 -6
- package/dist/codegen/generators/swift-model-keys.d.ts.map +0 -1
- package/dist/codegen/generators/swift-model-keys.js +0 -25
- package/dist/codegen/generators/swift-types.d.ts +0 -13
- package/dist/codegen/generators/swift-types.d.ts.map +0 -1
- package/dist/codegen/generators/swift-types.js +0 -188
- package/dist/codegen/generators/typed-operations-common.d.ts +0 -6
- package/dist/codegen/generators/typed-operations-common.d.ts.map +0 -1
- package/dist/codegen/generators/typed-operations-common.js +0 -84
- package/dist/codegen/generators/typed-operations-index.d.ts +0 -6
- package/dist/codegen/generators/typed-operations-index.d.ts.map +0 -1
- package/dist/codegen/generators/typed-operations-index.js +0 -22
- package/dist/codegen/generators/typed-operations.d.ts +0 -11
- package/dist/codegen/generators/typed-operations.d.ts.map +0 -1
- package/dist/codegen/generators/typed-operations.js +0 -263
- package/dist/codegen/swift-field-mapping.d.ts +0 -30
- package/dist/codegen/swift-field-mapping.d.ts.map +0 -1
- package/dist/codegen/swift-field-mapping.js +0 -150
- package/dist/codegen/write-files.d.ts +0 -15
- package/dist/codegen/write-files.d.ts.map +0 -1
- package/dist/codegen/write-files.js +0 -36
- package/dist/commands/api-keys.d.ts +0 -4
- package/dist/commands/api-keys.d.ts.map +0 -1
- package/dist/commands/api-keys.js +0 -129
- package/dist/commands/auth-config.d.ts +0 -4
- package/dist/commands/auth-config.d.ts.map +0 -1
- package/dist/commands/auth-config.js +0 -38
- package/dist/commands/auth-providers.d.ts +0 -4
- package/dist/commands/auth-providers.d.ts.map +0 -1
- package/dist/commands/auth-providers.js +0 -207
- package/dist/commands/context.d.ts +0 -4
- package/dist/commands/context.d.ts.map +0 -1
- package/dist/commands/context.js +0 -91
- package/dist/commands/create-extension.d.ts +0 -4
- package/dist/commands/create-extension.d.ts.map +0 -1
- package/dist/commands/create-extension.js +0 -60
- package/dist/commands/customer-profiles.d.ts +0 -4
- package/dist/commands/customer-profiles.d.ts.map +0 -1
- package/dist/commands/customer-profiles.js +0 -99
- package/dist/commands/customers.d.ts +0 -4
- package/dist/commands/customers.d.ts.map +0 -1
- package/dist/commands/customers.js +0 -126
- package/dist/commands/embeddings.d.ts +0 -4
- package/dist/commands/embeddings.d.ts.map +0 -1
- package/dist/commands/embeddings.js +0 -145
- package/dist/commands/experiments.d.ts +0 -4
- package/dist/commands/experiments.d.ts.map +0 -1
- package/dist/commands/experiments.js +0 -196
- package/dist/commands/extensions.d.ts +0 -4
- package/dist/commands/extensions.d.ts.map +0 -1
- package/dist/commands/extensions.js +0 -210
- package/dist/commands/files.d.ts +0 -4
- package/dist/commands/files.d.ts.map +0 -1
- package/dist/commands/files.js +0 -143
- package/dist/commands/hooks.d.ts +0 -4
- package/dist/commands/hooks.d.ts.map +0 -1
- package/dist/commands/hooks.js +0 -228
- package/dist/commands/locales.d.ts +0 -4
- package/dist/commands/locales.d.ts.map +0 -1
- package/dist/commands/locales.js +0 -140
- package/dist/commands/login.d.ts +0 -4
- package/dist/commands/login.d.ts.map +0 -1
- package/dist/commands/login.js +0 -124
- package/dist/commands/logout.d.ts +0 -4
- package/dist/commands/logout.d.ts.map +0 -1
- package/dist/commands/logout.js +0 -16
- package/dist/commands/media.d.ts +0 -4
- package/dist/commands/media.d.ts.map +0 -1
- package/dist/commands/media.js +0 -44
- package/dist/commands/models.d.ts +0 -4
- package/dist/commands/models.d.ts.map +0 -1
- package/dist/commands/models.js +0 -153
- package/dist/commands/notes.d.ts +0 -4
- package/dist/commands/notes.d.ts.map +0 -1
- package/dist/commands/notes.js +0 -132
- package/dist/commands/notifications.d.ts +0 -4
- package/dist/commands/notifications.d.ts.map +0 -1
- package/dist/commands/notifications.js +0 -73
- package/dist/commands/operations.d.ts +0 -4
- package/dist/commands/operations.d.ts.map +0 -1
- package/dist/commands/operations.js +0 -341
- package/dist/commands/pull.d.ts +0 -4
- package/dist/commands/pull.d.ts.map +0 -1
- package/dist/commands/pull.js +0 -300
- package/dist/commands/records.d.ts +0 -4
- package/dist/commands/records.d.ts.map +0 -1
- package/dist/commands/records.js +0 -314
- package/dist/commands/schedules.d.ts +0 -4
- package/dist/commands/schedules.d.ts.map +0 -1
- package/dist/commands/schedules.js +0 -155
- package/dist/commands/search.d.ts +0 -4
- package/dist/commands/search.d.ts.map +0 -1
- package/dist/commands/search.js +0 -60
- package/dist/commands/segments.d.ts +0 -4
- package/dist/commands/segments.d.ts.map +0 -1
- package/dist/commands/segments.js +0 -155
- package/dist/commands/select-project.d.ts +0 -4
- package/dist/commands/select-project.d.ts.map +0 -1
- package/dist/commands/select-project.js +0 -144
- package/dist/commands/settings.d.ts +0 -4
- package/dist/commands/settings.d.ts.map +0 -1
- package/dist/commands/settings.js +0 -115
- package/dist/commands/variant-catalog.d.ts +0 -4
- package/dist/commands/variant-catalog.d.ts.map +0 -1
- package/dist/commands/variant-catalog.js +0 -118
- package/dist/commands/whoami.d.ts +0 -4
- package/dist/commands/whoami.d.ts.map +0 -1
- package/dist/commands/whoami.js +0 -51
- package/dist/config/pull-config.d.ts +0 -33
- package/dist/config/pull-config.d.ts.map +0 -1
- package/dist/config/pull-config.js +0 -119
- package/dist/config/types.d.ts.map +0 -1
- package/dist/graphql/generated.d.ts +0 -8330
- package/dist/graphql/generated.d.ts.map +0 -1
- package/dist/graphql/generated.js +0 -135
- package/dist/lib/client.d.ts +0 -18
- package/dist/lib/client.d.ts.map +0 -1
- package/dist/lib/client.js +0 -64
- package/dist/lib/config-loader.d.ts +0 -28
- package/dist/lib/config-loader.d.ts.map +0 -1
- package/dist/lib/config-loader.js +0 -49
- package/dist/lib/config.d.ts +0 -12
- package/dist/lib/config.d.ts.map +0 -1
- package/dist/lib/config.js +0 -8
- package/dist/lib/errors.d.ts +0 -6
- package/dist/lib/errors.d.ts.map +0 -1
- package/dist/lib/errors.js +0 -76
- package/dist/lib/extension-helpers.d.ts.map +0 -1
- package/dist/lib/hook-helpers.d.ts.map +0 -1
- package/dist/lib/input.d.ts +0 -38
- package/dist/lib/input.d.ts.map +0 -1
- package/dist/lib/input.js +0 -108
- package/dist/lib/output.d.ts +0 -31
- package/dist/lib/output.d.ts.map +0 -1
- package/dist/lib/output.js +0 -107
- package/dist/lib/seed-helpers.d.ts.map +0 -1
- package/dist/scaffold/package-manager.d.ts +0 -12
- package/dist/scaffold/package-manager.d.ts.map +0 -1
- package/dist/scaffold/package-manager.js +0 -51
- package/dist/scaffold/scaffold.d.ts +0 -4
- package/dist/scaffold/scaffold.d.ts.map +0 -1
- package/dist/scaffold/scaffold.js +0 -462
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"variant-catalog.d.ts","sourceRoot":"","sources":["../../src/commands/variant-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AActD,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,CAyJN"}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { withErrorHandler } from '../lib/errors.js';
|
|
2
|
-
import { createClient } from '../lib/client.js';
|
|
3
|
-
import { formatOutput, formatList, success } from '../lib/output.js';
|
|
4
|
-
import { parseInputData, isUUID, confirmAction } from '../lib/input.js';
|
|
5
|
-
import { ListVariantCatalogDocument, GetVariantCatalogEntryDocument, GetVariantCatalogEntryByKeyDocument, CreateVariantCatalogEntryDocument, UpdateVariantCatalogEntryDocument, DeleteVariantCatalogEntryDocument, } from '../graphql/generated.js';
|
|
6
|
-
export function registerVariantCatalogCommands(program, globalOpts) {
|
|
7
|
-
const catalog = program
|
|
8
|
-
.command('variant-catalog')
|
|
9
|
-
.description('Manage variant catalog entries (markets, devices, locales)');
|
|
10
|
-
// list
|
|
11
|
-
catalog
|
|
12
|
-
.command('list')
|
|
13
|
-
.description('List variant catalog entries')
|
|
14
|
-
.option('--active', 'Only active entries')
|
|
15
|
-
.option('--limit <n>', 'Max results', '50')
|
|
16
|
-
.action(withErrorHandler(globalOpts, async (cmdOpts) => {
|
|
17
|
-
const opts = globalOpts();
|
|
18
|
-
const client = await createClient(opts);
|
|
19
|
-
const data = await client.request(ListVariantCatalogDocument, {
|
|
20
|
-
isActive: cmdOpts.active ? true : undefined,
|
|
21
|
-
limit: parseInt(String(cmdOpts.limit ?? '50'), 10),
|
|
22
|
-
});
|
|
23
|
-
formatList(data.variantCatalog, opts, {
|
|
24
|
-
columns: [
|
|
25
|
-
{ key: 'key', header: 'Key', width: 20 },
|
|
26
|
-
{ key: 'name', header: 'Name', width: 24 },
|
|
27
|
-
{
|
|
28
|
-
key: 'isDefault',
|
|
29
|
-
header: 'Default',
|
|
30
|
-
width: 8,
|
|
31
|
-
format: (v) => (v ? 'yes' : ''),
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
key: 'isActive',
|
|
35
|
-
header: 'Active',
|
|
36
|
-
width: 8,
|
|
37
|
-
format: (v) => (v ? 'yes' : 'no'),
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
});
|
|
41
|
-
}));
|
|
42
|
-
// get
|
|
43
|
-
catalog
|
|
44
|
-
.command('get <idOrKey>')
|
|
45
|
-
.description('Get a variant catalog entry by ID or key')
|
|
46
|
-
.action(withErrorHandler(globalOpts, async (idOrKey) => {
|
|
47
|
-
const opts = globalOpts();
|
|
48
|
-
const client = await createClient(opts);
|
|
49
|
-
let result;
|
|
50
|
-
if (isUUID(idOrKey)) {
|
|
51
|
-
const data = await client.request(GetVariantCatalogEntryDocument, {
|
|
52
|
-
id: idOrKey,
|
|
53
|
-
});
|
|
54
|
-
result = data.variantCatalogEntry;
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
const data = await client.request(GetVariantCatalogEntryByKeyDocument, { key: idOrKey });
|
|
58
|
-
result = data.variantCatalogEntryByKey;
|
|
59
|
-
}
|
|
60
|
-
if (!result)
|
|
61
|
-
throw new Error(`Variant catalog entry "${idOrKey}" not found.`);
|
|
62
|
-
formatOutput(result, opts);
|
|
63
|
-
}));
|
|
64
|
-
// create
|
|
65
|
-
catalog
|
|
66
|
-
.command('create')
|
|
67
|
-
.description('Create a variant catalog entry')
|
|
68
|
-
.option('-d, --data <json>', 'Entry data as JSON')
|
|
69
|
-
.option('-f, --file <path>', 'Read data from file')
|
|
70
|
-
.action(withErrorHandler(globalOpts, async (cmdOpts) => {
|
|
71
|
-
const opts = globalOpts();
|
|
72
|
-
const client = await createClient(opts);
|
|
73
|
-
const input = await parseInputData(cmdOpts);
|
|
74
|
-
const data = await client.request(CreateVariantCatalogEntryDocument, {
|
|
75
|
-
input,
|
|
76
|
-
});
|
|
77
|
-
formatOutput(data.createVariantCatalogEntry, opts);
|
|
78
|
-
if (!(opts.json || opts.jsonl || opts.quiet))
|
|
79
|
-
success(`Created variant catalog entry ${data.createVariantCatalogEntry.key}`);
|
|
80
|
-
}));
|
|
81
|
-
// update
|
|
82
|
-
catalog
|
|
83
|
-
.command('update <id>')
|
|
84
|
-
.description('Update a variant catalog entry')
|
|
85
|
-
.option('-d, --data <json>', 'Entry data as JSON')
|
|
86
|
-
.option('-f, --file <path>', 'Read data from file')
|
|
87
|
-
.action(withErrorHandler(globalOpts, async (id, cmdOpts) => {
|
|
88
|
-
const opts = globalOpts();
|
|
89
|
-
const client = await createClient(opts);
|
|
90
|
-
const input = await parseInputData(cmdOpts);
|
|
91
|
-
const data = await client.request(UpdateVariantCatalogEntryDocument, {
|
|
92
|
-
id,
|
|
93
|
-
input,
|
|
94
|
-
});
|
|
95
|
-
formatOutput(data.updateVariantCatalogEntry, opts);
|
|
96
|
-
if (!(opts.json || opts.jsonl || opts.quiet))
|
|
97
|
-
success(`Updated variant catalog entry ${data.updateVariantCatalogEntry.key}`);
|
|
98
|
-
}));
|
|
99
|
-
// delete
|
|
100
|
-
catalog
|
|
101
|
-
.command('delete <id>')
|
|
102
|
-
.description('Delete a variant catalog entry')
|
|
103
|
-
.option('--confirm', 'Skip confirmation prompt')
|
|
104
|
-
.action(withErrorHandler(globalOpts, async (id, cmdOpts) => {
|
|
105
|
-
const opts = globalOpts();
|
|
106
|
-
const confirmed = await confirmAction(`Delete variant catalog entry ${id}?`, { confirm: !!cmdOpts.confirm });
|
|
107
|
-
if (!confirmed) {
|
|
108
|
-
console.log('Aborted.');
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
const client = await createClient(opts);
|
|
112
|
-
await client.request(DeleteVariantCatalogEntryDocument, { id });
|
|
113
|
-
if (opts.json || opts.jsonl)
|
|
114
|
-
formatOutput({ deleted: true, id }, opts);
|
|
115
|
-
else
|
|
116
|
-
success(`Deleted variant catalog entry ${id}`);
|
|
117
|
-
}));
|
|
118
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../src/commands/whoami.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAItD,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,CAyDN"}
|
package/dist/commands/whoami.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { getCredentials, getProjectContext, isTokenExpired, } from '../auth/credentials.js';
|
|
2
|
-
import { withErrorHandler } from '../lib/errors.js';
|
|
3
|
-
import { formatOutput } from '../lib/output.js';
|
|
4
|
-
export function registerWhoamiCommand(program, globalOpts) {
|
|
5
|
-
program
|
|
6
|
-
.command('whoami')
|
|
7
|
-
.description('Show current authentication status')
|
|
8
|
-
.action(withErrorHandler(globalOpts, async () => {
|
|
9
|
-
const opts = globalOpts();
|
|
10
|
-
const credentials = await getCredentials();
|
|
11
|
-
if (!credentials) {
|
|
12
|
-
if (opts.json || opts.jsonl) {
|
|
13
|
-
formatOutput({ authenticated: false }, opts);
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
console.log('Not logged in.');
|
|
17
|
-
console.log('\nRun `foir login` to authenticate.');
|
|
18
|
-
}
|
|
19
|
-
throw new Error('Not authenticated');
|
|
20
|
-
}
|
|
21
|
-
const expired = isTokenExpired(credentials);
|
|
22
|
-
const projectContext = await getProjectContext();
|
|
23
|
-
if (opts.json || opts.jsonl) {
|
|
24
|
-
formatOutput({
|
|
25
|
-
authenticated: true,
|
|
26
|
-
tokenValid: !expired,
|
|
27
|
-
user: credentials.user,
|
|
28
|
-
selectedProject: projectContext ?? null,
|
|
29
|
-
}, opts);
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
console.log('Authentication Status');
|
|
33
|
-
console.log('─'.repeat(40));
|
|
34
|
-
console.log(`User: ${credentials.user.name} <${credentials.user.email}>`);
|
|
35
|
-
console.log(`User ID: ${credentials.user.id}`);
|
|
36
|
-
console.log(`Token: ${expired ? '⚠ Expired' : '✓ Valid'}`);
|
|
37
|
-
if (projectContext) {
|
|
38
|
-
console.log('');
|
|
39
|
-
console.log('Selected Project (this repo)');
|
|
40
|
-
console.log('─'.repeat(40));
|
|
41
|
-
console.log(`Name: ${projectContext.name}`);
|
|
42
|
-
console.log(`ID: ${projectContext.id}`);
|
|
43
|
-
console.log(`Tenant ID: ${projectContext.tenantId}`);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
console.log('');
|
|
47
|
-
console.log('No project selected for this repository.');
|
|
48
|
-
console.log('Run `foir select-project` to choose a project.');
|
|
49
|
-
}
|
|
50
|
-
}));
|
|
51
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pull config loader — searches for foir.config.ts / .foirrc.ts and merges with CLI flags.
|
|
3
|
-
*/
|
|
4
|
-
import type { CodegenTarget, DomainConfig } from './types.js';
|
|
5
|
-
export interface PullCliFlags {
|
|
6
|
-
config?: string;
|
|
7
|
-
only?: string;
|
|
8
|
-
noPrettier?: boolean;
|
|
9
|
-
dryRun?: boolean;
|
|
10
|
-
out?: string;
|
|
11
|
-
swift?: string;
|
|
12
|
-
}
|
|
13
|
-
export interface ResolvedPullConfig {
|
|
14
|
-
output: {
|
|
15
|
-
types: string;
|
|
16
|
-
documents: string;
|
|
17
|
-
operations: string;
|
|
18
|
-
hooks?: string;
|
|
19
|
-
loaders?: string;
|
|
20
|
-
swift?: string;
|
|
21
|
-
};
|
|
22
|
-
targets: CodegenTarget[];
|
|
23
|
-
domains: Required<DomainConfig>;
|
|
24
|
-
only: string[];
|
|
25
|
-
includeInline: boolean;
|
|
26
|
-
prettier: boolean;
|
|
27
|
-
dryRun: boolean;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Load and merge config from file + CLI flags.
|
|
31
|
-
*/
|
|
32
|
-
export declare function loadPullConfig(flags: PullCliFlags): Promise<ResolvedPullConfig>;
|
|
33
|
-
//# sourceMappingURL=pull-config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pull-config.d.ts","sourceRoot":"","sources":["../../src/config/pull-config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAGV,aAAa,EACb,YAAY,EACb,MAAM,YAAY,CAAC;AAuDpB,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,OAAO,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;IAChC,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE,YAAY,GAClB,OAAO,CAAC,kBAAkB,CAAC,CAqE7B"}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pull config loader — searches for foir.config.ts / .foirrc.ts and merges with CLI flags.
|
|
3
|
-
*/
|
|
4
|
-
import { resolve } from 'path';
|
|
5
|
-
import { pathToFileURL } from 'url';
|
|
6
|
-
import { existsSync } from 'fs';
|
|
7
|
-
const CONFIG_FILE_NAMES = [
|
|
8
|
-
'foir.config.ts',
|
|
9
|
-
'foir.config.js',
|
|
10
|
-
'foir.config.mjs',
|
|
11
|
-
'.foirrc.ts',
|
|
12
|
-
'.foirrc.js',
|
|
13
|
-
'.foirrc.mjs',
|
|
14
|
-
];
|
|
15
|
-
const DEFAULT_TYPES_DIR = './src/generated/types';
|
|
16
|
-
const DEFAULT_DOCS_DIR = './src/generated/documents';
|
|
17
|
-
const ALL_DOMAINS = {
|
|
18
|
-
auth: true,
|
|
19
|
-
authProviders: true,
|
|
20
|
-
files: true,
|
|
21
|
-
sync: true,
|
|
22
|
-
notifications: true,
|
|
23
|
-
operations: true,
|
|
24
|
-
schedules: true,
|
|
25
|
-
sharing: true,
|
|
26
|
-
embeddings: true,
|
|
27
|
-
analytics: true,
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Resolve a config file from the given directory (or cwd).
|
|
31
|
-
*/
|
|
32
|
-
function findConfigFile(explicitPath) {
|
|
33
|
-
if (explicitPath) {
|
|
34
|
-
const abs = resolve(explicitPath);
|
|
35
|
-
if (existsSync(abs))
|
|
36
|
-
return abs;
|
|
37
|
-
throw new Error(`Config file not found: ${explicitPath}`);
|
|
38
|
-
}
|
|
39
|
-
const cwd = process.cwd();
|
|
40
|
-
for (const name of CONFIG_FILE_NAMES) {
|
|
41
|
-
const candidate = resolve(cwd, name);
|
|
42
|
-
if (existsSync(candidate))
|
|
43
|
-
return candidate;
|
|
44
|
-
}
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Dynamically import a config file (supports .ts via tsx loader, .js, .mjs).
|
|
49
|
-
*/
|
|
50
|
-
async function loadConfigFile(filePath) {
|
|
51
|
-
const url = pathToFileURL(filePath).href;
|
|
52
|
-
const mod = await import(url);
|
|
53
|
-
const config = mod.default ?? mod;
|
|
54
|
-
return config;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Load and merge config from file + CLI flags.
|
|
58
|
-
*/
|
|
59
|
-
export async function loadPullConfig(flags) {
|
|
60
|
-
let fileConfig = {};
|
|
61
|
-
const configPath = findConfigFile(flags.config);
|
|
62
|
-
if (configPath) {
|
|
63
|
-
const full = await loadConfigFile(configPath);
|
|
64
|
-
fileConfig = full.pull ?? {};
|
|
65
|
-
}
|
|
66
|
-
// Merge: defaults ← file config ← CLI flags
|
|
67
|
-
const types = flags.out ?? fileConfig.output?.types ?? DEFAULT_TYPES_DIR;
|
|
68
|
-
const documents = fileConfig.output?.documents ?? DEFAULT_DOCS_DIR;
|
|
69
|
-
const swift = flags.swift ?? fileConfig.output?.swift;
|
|
70
|
-
// Targets
|
|
71
|
-
const targets = fileConfig.targets ?? [];
|
|
72
|
-
// Operations dir defaults to sibling of types dir
|
|
73
|
-
const typesParent = types.replace(/\/[^/]+$/, '');
|
|
74
|
-
const operations = fileConfig.output?.operations ?? `${typesParent}/operations`;
|
|
75
|
-
// Hooks and loaders only resolve when matching target is present
|
|
76
|
-
const hooks = targets.includes('react')
|
|
77
|
-
? (fileConfig.output?.hooks ?? `${typesParent}/hooks`)
|
|
78
|
-
: undefined;
|
|
79
|
-
const loaders = targets.includes('remix')
|
|
80
|
-
? (fileConfig.output?.loaders ?? `${typesParent}/loaders`)
|
|
81
|
-
: undefined;
|
|
82
|
-
const output = {
|
|
83
|
-
types,
|
|
84
|
-
documents,
|
|
85
|
-
operations,
|
|
86
|
-
...(hooks ? { hooks } : {}),
|
|
87
|
-
...(loaders ? { loaders } : {}),
|
|
88
|
-
...(swift ? { swift } : {}),
|
|
89
|
-
};
|
|
90
|
-
// Domains: true = all, false = none, object = selective
|
|
91
|
-
let domains;
|
|
92
|
-
if (fileConfig.domains === false) {
|
|
93
|
-
domains = {
|
|
94
|
-
auth: false,
|
|
95
|
-
authProviders: false,
|
|
96
|
-
files: false,
|
|
97
|
-
sync: false,
|
|
98
|
-
notifications: false,
|
|
99
|
-
operations: false,
|
|
100
|
-
schedules: false,
|
|
101
|
-
sharing: false,
|
|
102
|
-
embeddings: false,
|
|
103
|
-
analytics: false,
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
else if (typeof fileConfig.domains === 'object') {
|
|
107
|
-
domains = { ...ALL_DOMAINS, ...fileConfig.domains };
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
domains = { ...ALL_DOMAINS };
|
|
111
|
-
}
|
|
112
|
-
const only = flags.only
|
|
113
|
-
? flags.only.split(',').map((s) => s.trim())
|
|
114
|
-
: (fileConfig.only ?? []);
|
|
115
|
-
const includeInline = fileConfig.includeInline ?? true;
|
|
116
|
-
const prettier = flags.noPrettier ? false : (fileConfig.prettier ?? true);
|
|
117
|
-
const dryRun = flags.dryRun ?? false;
|
|
118
|
-
return { output, targets, domains, only, includeInline, prettier, dryRun };
|
|
119
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,OAAO,CAAC;AAE9C,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE;QACP,kFAAkF;QAClF,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,uFAAuF;QACvF,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,kFAAkF;QAClF,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,oEAAoE;QACpE,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,sEAAsE;QACtE,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,sEAAsE;QACtE,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,oFAAoF;IACpF,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;IAC1B,sEAAsE;IACtE,OAAO,CAAC,EAAE,OAAO,GAAG,YAAY,CAAC;IACjC,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,qEAAqE;IACrE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAE3D"}
|