@eide/foir-cli 0.43.0 → 0.45.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/cli.js +24 -5
- package/dist/lib/config-helpers.d.ts +13 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -1326,6 +1326,20 @@ import {
|
|
|
1326
1326
|
RestoreModelVersionRequestSchema,
|
|
1327
1327
|
PublishModelRequestSchema
|
|
1328
1328
|
} from "@eide/foir-proto-ts/models/v1/models_pb";
|
|
1329
|
+
function buildModelWhere(p) {
|
|
1330
|
+
const clauses = [];
|
|
1331
|
+
if (p.search) {
|
|
1332
|
+
clauses.push({
|
|
1333
|
+
OR: [{ name: { contains: p.search } }, { key: { contains: p.search } }]
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
if (p.category) clauses.push({ category: { eq: p.category } });
|
|
1337
|
+
if (p.configId) clauses.push({ configId: { eq: p.configId } });
|
|
1338
|
+
if (p.inline !== void 0) clauses.push({ inline: { eq: p.inline } });
|
|
1339
|
+
if (clauses.length === 0) return void 0;
|
|
1340
|
+
if (clauses.length === 1) return clauses[0];
|
|
1341
|
+
return { AND: clauses };
|
|
1342
|
+
}
|
|
1329
1343
|
function jsFieldToProto(f) {
|
|
1330
1344
|
return create3(ProtoFieldSchema, {
|
|
1331
1345
|
id: f.id,
|
|
@@ -1340,7 +1354,11 @@ function jsFieldToProto(f) {
|
|
|
1340
1354
|
itemType: f.itemType,
|
|
1341
1355
|
storage: f.storage,
|
|
1342
1356
|
templateZone: f.templateZone,
|
|
1343
|
-
zoneOrder: f.zoneOrder
|
|
1357
|
+
zoneOrder: f.zoneOrder,
|
|
1358
|
+
// Per-field {read, write} principal policy. foir.config.ts authors set
|
|
1359
|
+
// e.g. access: { write: ['service', 'admin'] } to lock a field; the
|
|
1360
|
+
// platform enforces it on every write path.
|
|
1361
|
+
access: f.access
|
|
1344
1362
|
});
|
|
1345
1363
|
}
|
|
1346
1364
|
function jsConfigToProto(c) {
|
|
@@ -1403,9 +1421,7 @@ function createModelsMethods(client) {
|
|
|
1403
1421
|
async listModels(params = {}) {
|
|
1404
1422
|
const resp = await client.listModels(
|
|
1405
1423
|
create3(ListModelsRequestSchema, {
|
|
1406
|
-
|
|
1407
|
-
category: params.category,
|
|
1408
|
-
configId: params.configId,
|
|
1424
|
+
where: buildModelWhere(params),
|
|
1409
1425
|
first: params.first ?? DEFAULT_PAGE_SIZE,
|
|
1410
1426
|
after: params?.after
|
|
1411
1427
|
})
|
|
@@ -2422,7 +2438,10 @@ function createSettingsMethods(client) {
|
|
|
2422
2438
|
required: f.required,
|
|
2423
2439
|
helpText: f.helpText,
|
|
2424
2440
|
placeholder: f.placeholder,
|
|
2425
|
-
config: f.config
|
|
2441
|
+
config: f.config,
|
|
2442
|
+
// Per-field write/read principal policy — e.g. lock `plan` to
|
|
2443
|
+
// write:[service, admin] so a customer can't self-grant.
|
|
2444
|
+
access: f.access
|
|
2426
2445
|
})),
|
|
2427
2446
|
publicFields: params.publicFields
|
|
2428
2447
|
})
|
|
@@ -40,6 +40,17 @@ interface EnumFieldConfig {
|
|
|
40
40
|
multiple?: boolean;
|
|
41
41
|
default?: string | string[];
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Per-field {read, write} principal allow-lists. A non-empty `write` names
|
|
45
|
+
* the only principals permitted to write the field — "public" | "self" |
|
|
46
|
+
* "scoped" | "service" | "admin" — and any other principal is rejected by the
|
|
47
|
+
* platform on every write path. Omit for the default (writable by any
|
|
48
|
+
* authenticated principal). `read` governs client API exposure only.
|
|
49
|
+
*/
|
|
50
|
+
interface FieldAccessInput {
|
|
51
|
+
read?: string[];
|
|
52
|
+
write?: string[];
|
|
53
|
+
}
|
|
43
54
|
interface BaseFieldDefinitionInput {
|
|
44
55
|
key: string;
|
|
45
56
|
label?: string;
|
|
@@ -51,6 +62,7 @@ interface BaseFieldDefinitionInput {
|
|
|
51
62
|
storage?: string;
|
|
52
63
|
templateZone?: string;
|
|
53
64
|
zoneOrder?: number;
|
|
65
|
+
access?: FieldAccessInput;
|
|
54
66
|
}
|
|
55
67
|
type SelectFieldDefinitionInput = BaseFieldDefinitionInput & {
|
|
56
68
|
type: 'select';
|
|
@@ -554,4 +566,4 @@ interface FoirSecretsConfig {
|
|
|
554
566
|
*/
|
|
555
567
|
declare function defineSecrets(config: FoirSecretsConfig): FoirSecretsConfig;
|
|
556
568
|
|
|
557
|
-
export { type AppInput, type AppPlacementFieldChoiceInput, type AppSinkMappingInput, type AppSourceMappingInput, type ApplyConfigApiKeyInput, type ApplyConfigAuthProviderInput, type ApplyConfigDesignTokensInput, type ApplyConfigHookInput, type ApplyConfigInput, type ApplyConfigModelInput, type ApplyConfigOperationInput, type ApplyConfigPlacementInput, type ApplyConfigProjectInput, type ApplyConfigProjectSettingsInput, type ApplyConfigScheduleInput, type ApplyConfigSegmentInput, type EnumFieldConfig, type EnumFieldDefinitionInput, type EnumFieldOption, type ExpressionPrecondition, type FieldDefinitionInput, type FoirSecretsConfig, type LookupDefinitionInput, type Precondition, type QuotaRule, type SecretDeclaration, type SecretOwnerKind, type SegmentPrecondition, type SelectFieldConfig, type SelectFieldDefinitionInput, defineAuthProvider, defineConfig, defineDesignTokens, defineEnumField, defineField, defineHook, defineModel, defineOperation, definePlacement, defineSchedule, defineSecrets, defineSegment, defineSelectField };
|
|
569
|
+
export { type AppInput, type AppPlacementFieldChoiceInput, type AppSinkMappingInput, type AppSourceMappingInput, type ApplyConfigApiKeyInput, type ApplyConfigAuthProviderInput, type ApplyConfigDesignTokensInput, type ApplyConfigHookInput, type ApplyConfigInput, type ApplyConfigModelInput, type ApplyConfigOperationInput, type ApplyConfigPlacementInput, type ApplyConfigProjectInput, type ApplyConfigProjectSettingsInput, type ApplyConfigScheduleInput, type ApplyConfigSegmentInput, type EnumFieldConfig, type EnumFieldDefinitionInput, type EnumFieldOption, type ExpressionPrecondition, type FieldAccessInput, type FieldDefinitionInput, type FoirSecretsConfig, type LookupDefinitionInput, type Precondition, type QuotaRule, type SecretDeclaration, type SecretOwnerKind, type SegmentPrecondition, type SelectFieldConfig, type SelectFieldDefinitionInput, defineAuthProvider, defineConfig, defineDesignTokens, defineEnumField, defineField, defineHook, defineModel, defineOperation, definePlacement, defineSchedule, defineSecrets, defineSegment, defineSelectField };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eide/foir-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.0",
|
|
4
4
|
"description": "Universal platform CLI for Foir platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@bufbuild/protovalidate": "^1.1.1",
|
|
51
51
|
"@connectrpc/connect": "^2.0.0",
|
|
52
52
|
"@connectrpc/connect-node": "^2.0.0",
|
|
53
|
-
"@eide/foir-proto-ts": "^0.
|
|
53
|
+
"@eide/foir-proto-ts": "^0.101.0",
|
|
54
54
|
"chalk": "^5.3.0",
|
|
55
55
|
"commander": "^12.1.0",
|
|
56
56
|
"dotenv": "^16.4.5",
|