@revoengine/cli 1.0.18 → 1.0.19
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/README.md +5 -3
- package/dist/src/client.d.ts +25 -4
- package/dist/src/client.js +1 -1
- package/dist/src/commands/component.js +25 -0
- package/dist/src/project.js +1 -1
- package/dist/src/resource-syncs/service-account-sync.js +38 -3
- package/dist/src/types.d.ts +17 -0
- package/dist/src/ui.js +1 -1
- package/dist/src/workspace-prune.js +26 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -510,7 +510,9 @@ revo request GET /api/component/list
|
|
|
510
510
|
revo request POST /api/component '{"name":"Customer Card"}'
|
|
511
511
|
|
|
512
512
|
# Debug a local component in the sandbox
|
|
513
|
-
revo component debug <componentId> --stream
|
|
513
|
+
revo component debug <componentId> --read-only=true --stream
|
|
514
|
+
# Full execution requires a component execution role:
|
|
515
|
+
revo component debug <componentId> --read-only=false
|
|
514
516
|
```
|
|
515
517
|
|
|
516
518
|
Use low-level `request` carefully; it bypasses the higher-level migration planner.
|
|
@@ -560,7 +562,7 @@ The same family is included in `revo pull --all`, repository `diff`/`plan`/`depl
|
|
|
560
562
|
Select it alone with `--resources service-account`. Named profiles (`--project`/`--env`), URL/token environment variables,
|
|
561
563
|
and the ordinary authenticated runtime work through the existing config resolution. `--force` retains the existing drift policy.
|
|
562
564
|
|
|
563
|
-
The portable manifest contains the Stable Key, name, and
|
|
565
|
+
The portable manifest contains the Stable Key, name, and a single Group or Service Account management principal. The manifest field `owner` remains the portable dependency policy; Platform 1.6.4 writes it as a restricted management `access` ACL, with target UUIDs and no legacy `ownerId`/`ownerType` fields.
|
|
564
566
|
Group USER owners and Job Template `triggerUser` references to Service Accounts are resolved to target `userId` at write time.
|
|
565
567
|
Human principals are reported for manual configuration; an account with a human owner needs a target account with the exact Stable Key before it can be adopted.
|
|
566
568
|
A missing or circular owner dependency blocks writes. Groups and accounts are created in dependency order before their consumers.
|
|
@@ -568,4 +570,4 @@ A missing or circular owner dependency blocks writes. Groups and accounts are cr
|
|
|
568
570
|
API keys and secrets cannot be exported. Every newly created Service Account is active and has platform access but has no migrated credentials.
|
|
569
571
|
The push result contains `credentials: { stableKey, environment, policy: "target-local", status: "configure-manually" }`.
|
|
570
572
|
Existing target secrets remain local and are never compared, copied, rotated, or exposed in manifests, plans, lock files, or HTTP trace.
|
|
571
|
-
|
|
573
|
+
Execution memberships, unrestricted or multiple-principal management ACLs, other account metadata, and `metadataAdvanced` remain target-local. Existing self access is preserved when a portable management principal changes; name/metadata updates omit the ACL. Complex target ACLs cannot be replaced through the single-principal manifest, including with `--force`.
|
package/dist/src/client.d.ts
CHANGED
|
@@ -144,8 +144,31 @@ export type EndpointCreatePayload = Omit<EndpointWritePayload, 'version'> & {
|
|
|
144
144
|
export type ServiceAccountWritePayload = {
|
|
145
145
|
name?: string;
|
|
146
146
|
metadata?: Record<string, unknown>;
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
access?: {
|
|
148
|
+
restricted: boolean;
|
|
149
|
+
users?: Array<string | {
|
|
150
|
+
id: string;
|
|
151
|
+
} | {
|
|
152
|
+
mail: string;
|
|
153
|
+
}>;
|
|
154
|
+
groups?: Array<string | {
|
|
155
|
+
id: string;
|
|
156
|
+
} | {
|
|
157
|
+
name: string;
|
|
158
|
+
}>;
|
|
159
|
+
};
|
|
160
|
+
memberships?: {
|
|
161
|
+
groups?: Array<string | {
|
|
162
|
+
id: string;
|
|
163
|
+
} | {
|
|
164
|
+
name: string;
|
|
165
|
+
}>;
|
|
166
|
+
roleGroups?: Array<string | {
|
|
167
|
+
id: string;
|
|
168
|
+
} | {
|
|
169
|
+
name: string;
|
|
170
|
+
}>;
|
|
171
|
+
};
|
|
149
172
|
version?: number;
|
|
150
173
|
};
|
|
151
174
|
export type RoleGroupListRequest = {
|
|
@@ -416,8 +439,6 @@ export declare class RevoClient {
|
|
|
416
439
|
getServiceAccount(userId: string): Promise<ServiceAccountRecord>;
|
|
417
440
|
createServiceAccount(body: ServiceAccountWritePayload & {
|
|
418
441
|
name: string;
|
|
419
|
-
ownerId: string;
|
|
420
|
-
ownerType: 'USER' | 'GROUP';
|
|
421
442
|
}): Promise<ServiceAccountRecord>;
|
|
422
443
|
updateServiceAccount(userId: string, body: ServiceAccountWritePayload): Promise<ServiceAccountRecord>;
|
|
423
444
|
listRoleGroups(options?: RoleGroupListRequest): Promise<unknown>;
|
package/dist/src/client.js
CHANGED
|
@@ -1208,7 +1208,7 @@ export class RevoClient {
|
|
|
1208
1208
|
throw new Error('Invalid account response.');
|
|
1209
1209
|
}
|
|
1210
1210
|
const record = {};
|
|
1211
|
-
for (const field of ['userId', 'name', 'serviceAccount', 'ownerId', 'ownerType', 'version', 'deletedAt']) {
|
|
1211
|
+
for (const field of ['userId', 'name', 'serviceAccount', 'ownerId', 'ownerType', 'access', 'memberships', 'version', 'deletedAt']) {
|
|
1212
1212
|
if (wrapper[field] !== undefined) {
|
|
1213
1213
|
Object.assign(record, { [field]: wrapper[field] });
|
|
1214
1214
|
}
|
|
@@ -1855,6 +1855,28 @@ function readLibraryDebugCode(cwd, type) {
|
|
|
1855
1855
|
const filePath = path.join(cwd, '.revoengine', fileName);
|
|
1856
1856
|
return fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : '';
|
|
1857
1857
|
}
|
|
1858
|
+
function resolveDebugReadOnly(cwd, flag) {
|
|
1859
|
+
if (flag !== undefined) {
|
|
1860
|
+
if (flag === true || flag === 'true')
|
|
1861
|
+
return true;
|
|
1862
|
+
if (flag === false || flag === 'false')
|
|
1863
|
+
return false;
|
|
1864
|
+
throw new Error('--read-only must be true or false.');
|
|
1865
|
+
}
|
|
1866
|
+
const configPath = path.join(getProjectRoot(cwd) || cwd, '.revoengine', 'debug.json');
|
|
1867
|
+
if (!fs.existsSync(configPath))
|
|
1868
|
+
return true;
|
|
1869
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
1870
|
+
if (typeof config.readOnly === 'boolean')
|
|
1871
|
+
return config.readOnly;
|
|
1872
|
+
if (typeof config.production === 'boolean') {
|
|
1873
|
+
const { production, ...rest } = config;
|
|
1874
|
+
const readOnly = !production;
|
|
1875
|
+
fs.writeFileSync(configPath, `${JSON.stringify({ ...rest, readOnly }, null, 2)}\n`);
|
|
1876
|
+
return readOnly;
|
|
1877
|
+
}
|
|
1878
|
+
return true;
|
|
1879
|
+
}
|
|
1858
1880
|
function buildDebugPayload(cwd, component, input) {
|
|
1859
1881
|
const type = normalizeComponentType(component);
|
|
1860
1882
|
const base = {
|
|
@@ -1862,6 +1884,7 @@ function buildDebugPayload(cwd, component, input) {
|
|
|
1862
1884
|
inputs: input.inputs,
|
|
1863
1885
|
timeout: input.timeout,
|
|
1864
1886
|
memory: input.memory,
|
|
1887
|
+
readOnly: input.readOnly,
|
|
1865
1888
|
...(input.extraLibs?.length ? { extraLibs: input.extraLibs } : {}),
|
|
1866
1889
|
};
|
|
1867
1890
|
if (!isDebugLibraryType(type)) {
|
|
@@ -1977,6 +2000,7 @@ async function debugSingleComponent(context, componentId) {
|
|
|
1977
2000
|
const inputs = parseDebugInputs(context.args);
|
|
1978
2001
|
const timeout = parseDebugNumber(context.args, ['timeout', 't'], 10, 600, 'Timeout');
|
|
1979
2002
|
const memory = parseDebugNumber(context.args, ['memory', 'm'], 128, 1024, 'Memory');
|
|
2003
|
+
const readOnly = resolveDebugReadOnly(context.cwd, context.args['read-only']);
|
|
1980
2004
|
const stream = readBoolFlag(context.args, ['stream']);
|
|
1981
2005
|
const includeExtraLibs = context.args['extra-libs'] !== false
|
|
1982
2006
|
&& !readBoolFlag(context.args, ['no-extra-libs']);
|
|
@@ -1991,6 +2015,7 @@ async function debugSingleComponent(context, componentId) {
|
|
|
1991
2015
|
inputs,
|
|
1992
2016
|
timeout,
|
|
1993
2017
|
memory,
|
|
2018
|
+
readOnly,
|
|
1994
2019
|
extraLibs: extraLibs.map((entry) => entry.payload),
|
|
1995
2020
|
});
|
|
1996
2021
|
const endpoint = stream ? buildSandboxDebugStreamUrl(sandboxEndpoint) : buildSandboxDebugUrl(sandboxEndpoint);
|
package/dist/src/project.js
CHANGED
|
@@ -526,7 +526,7 @@ export function ensureProjectDebugScaffolding(rootDir) {
|
|
|
526
526
|
[path.join(rootDir, REVO_DEBUG_CONFIG_FILE), `${JSON.stringify({
|
|
527
527
|
timeout: 10,
|
|
528
528
|
memory: 128,
|
|
529
|
-
|
|
529
|
+
readOnly: true,
|
|
530
530
|
}, null, 2)}\n`],
|
|
531
531
|
[path.join(rootDir, REVO_PLAYGROUND_JS_FILE), ''],
|
|
532
532
|
[path.join(rootDir, REVO_PLAYGROUND_TS_FILE), ''],
|
|
@@ -21,9 +21,26 @@ export async function serviceAccountManifestFromRecord(client, record, stableKey
|
|
|
21
21
|
stableKey,
|
|
22
22
|
name: String(record.name || ''),
|
|
23
23
|
metadata: { [stableKeyName]: stableKey },
|
|
24
|
-
owner: await
|
|
24
|
+
owner: await readManagementPrincipal(client, record, stableKeyName),
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
+
async function readManagementPrincipal(client, record, stableKeyName) {
|
|
28
|
+
// The manifest's portable owner now represents one management ACL principal.
|
|
29
|
+
// Self access is target-local and never creates a dependency on the account itself.
|
|
30
|
+
if (!record.access)
|
|
31
|
+
return readPortableOwner(client, record, stableKeyName);
|
|
32
|
+
const { restricted, users, groups } = record.access;
|
|
33
|
+
if (typeof restricted !== 'boolean' || !Array.isArray(users) || !Array.isArray(groups)) {
|
|
34
|
+
throw new Error('Invalid service-account management access response.');
|
|
35
|
+
}
|
|
36
|
+
const managers = users.filter(user => user.userId !== record.userId);
|
|
37
|
+
if (!restricted || managers.length + groups.length !== 1) {
|
|
38
|
+
return { type: 'unresolved', reason: 'unrestricted or multiple management principals require target-local configuration' };
|
|
39
|
+
}
|
|
40
|
+
return readPortableOwner(client, groups.length
|
|
41
|
+
? { ownerType: 'GROUP', ownerId: groups[0].groupId }
|
|
42
|
+
: { ownerType: 'USER', ownerId: managers[0].userId }, stableKeyName);
|
|
43
|
+
}
|
|
27
44
|
export function hashPortableServiceAccount(manifest) {
|
|
28
45
|
return hashStable({ kind: manifest.kind, stableKey: manifest.stableKey, name: manifest.name, metadata: manifest.metadata,
|
|
29
46
|
...(['group', 'service-account'].includes(manifest.owner.type) ? { owner: manifest.owner } : {}) });
|
|
@@ -427,15 +444,33 @@ export async function pullServiceAccountsToWorkspace(input) {
|
|
|
427
444
|
skipped,
|
|
428
445
|
};
|
|
429
446
|
}
|
|
447
|
+
async function managementAccessPayload(client, manifest, stableKeyName, target) {
|
|
448
|
+
if (target?.access) {
|
|
449
|
+
const managers = target.access.users.filter(user => user.userId !== target.userId);
|
|
450
|
+
if (!target.access.restricted || managers.length + target.access.groups.length !== 1) {
|
|
451
|
+
throw new Error('Target management ACL requires target-local configuration; portable owner cannot replace unrestricted or multiple principals.');
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
const principal = await resolvePortableOwner(client, manifest.owner, stableKeyName);
|
|
455
|
+
// Preserve an existing self grant without transferring its source UUID.
|
|
456
|
+
const users = target?.userId && target.access?.users.some(user => user.userId === target.userId)
|
|
457
|
+
? [{ id: target.userId }] : [];
|
|
458
|
+
const groups = [];
|
|
459
|
+
(principal.ownerType === 'USER' ? users : groups).push({ id: principal.ownerId });
|
|
460
|
+
return { restricted: true, users, groups };
|
|
461
|
+
}
|
|
430
462
|
async function buildCreatePayload(client, manifest, stableKeyName) {
|
|
431
|
-
return { name: manifest.name, metadata: manifest.metadata,
|
|
463
|
+
return { name: manifest.name, metadata: manifest.metadata, access: await managementAccessPayload(client, manifest, stableKeyName) };
|
|
432
464
|
}
|
|
433
465
|
async function buildBaseUpdatePayload(client, manifest, target, stableKeyName) {
|
|
434
466
|
if (!Number.isInteger(target.version)) {
|
|
435
467
|
throw new Error('target service-account version is required');
|
|
436
468
|
}
|
|
469
|
+
const ownerChanged = ['group', 'service-account'].includes(manifest.owner.type)
|
|
470
|
+
&& hashStable(manifest.owner) !== hashStable(await readManagementPrincipal(client, target, stableKeyName));
|
|
437
471
|
return { name: manifest.name, metadata: { ...sanitizeUserMetadata(target.metadata), ...manifest.metadata }, version: target.version,
|
|
438
|
-
...(
|
|
472
|
+
...(ownerChanged
|
|
473
|
+
? { access: await managementAccessPayload(client, manifest, stableKeyName, target) } : {}) };
|
|
439
474
|
}
|
|
440
475
|
function updateEnvironmentBaseline(input) {
|
|
441
476
|
const { projectRoot } = requireProjectLayout(input.cwd, 'Service-account');
|
package/dist/src/types.d.ts
CHANGED
|
@@ -159,11 +159,28 @@ export type EndpointRecord = {
|
|
|
159
159
|
deletedBy?: string | null;
|
|
160
160
|
[key: string]: unknown;
|
|
161
161
|
};
|
|
162
|
+
export type ServiceAccountAccessRecord = {
|
|
163
|
+
restricted: boolean;
|
|
164
|
+
users: Array<{
|
|
165
|
+
userId: string;
|
|
166
|
+
mail?: string;
|
|
167
|
+
name?: string;
|
|
168
|
+
}>;
|
|
169
|
+
groups: Array<{
|
|
170
|
+
groupId: string;
|
|
171
|
+
name?: string;
|
|
172
|
+
}>;
|
|
173
|
+
};
|
|
162
174
|
export type ServiceAccountRecord = {
|
|
163
175
|
category?: string | null;
|
|
164
176
|
userId?: string;
|
|
165
177
|
name?: string;
|
|
166
178
|
serviceAccount?: boolean;
|
|
179
|
+
access?: ServiceAccountAccessRecord;
|
|
180
|
+
memberships?: {
|
|
181
|
+
groups: string[];
|
|
182
|
+
roleGroups: string[];
|
|
183
|
+
};
|
|
167
184
|
ownerId?: string;
|
|
168
185
|
ownerType?: string;
|
|
169
186
|
version?: number;
|
package/dist/src/ui.js
CHANGED
|
@@ -130,7 +130,7 @@ function renderCommandCatalog() {
|
|
|
130
130
|
commandRow('revo component pull --all [--project <name>] [--yes] [--force]', 'Pull every available component safely'),
|
|
131
131
|
commandRow('revo component push <identity...> [--project <name>]', 'Push by configured stable key or component ID'),
|
|
132
132
|
commandRow('revo component push --all [--project <name>] [--yes] [--force] [--prune] [--changed --base <ref>]', 'Push local components with lock checks'),
|
|
133
|
-
commandRow('revo component debug <componentId> [BODY] [--
|
|
133
|
+
commandRow('revo component debug <componentId> [BODY] [--read-only=true|false] [--stream]', 'Run one local component in sandbox'),
|
|
134
134
|
'',
|
|
135
135
|
paintHeader('Databases'),
|
|
136
136
|
commandRow('revo database-tables pull --all [--project <name>] [--force] [--strict]', 'Pull portable Database Tables and partitions'),
|
|
@@ -95,9 +95,9 @@ function localReferences(resource, manifest) {
|
|
|
95
95
|
}
|
|
96
96
|
function remoteReferences(resource, record, tables) {
|
|
97
97
|
const refs = [];
|
|
98
|
-
const add = (family, value) => {
|
|
98
|
+
const add = (family, value, targetLocal = false) => {
|
|
99
99
|
if (typeof value === 'string' && value)
|
|
100
|
-
refs.push({ resource: family, identity: value });
|
|
100
|
+
refs.push({ resource: family, identity: value, targetLocal });
|
|
101
101
|
};
|
|
102
102
|
if (resource === 'job-template' || resource === 'endpoint')
|
|
103
103
|
add('component', record.componentId);
|
|
@@ -125,6 +125,26 @@ function remoteReferences(resource, record, tables) {
|
|
|
125
125
|
add('database-table', resourceIdOf(table));
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
+
if (resource === 'service-account') {
|
|
129
|
+
if (isRecord(record.access)) {
|
|
130
|
+
const users = Array.isArray(record.access.users) ? record.access.users.filter(user => isRecord(user) && user.userId !== record.userId) : [];
|
|
131
|
+
const groups = Array.isArray(record.access.groups) ? record.access.groups : [];
|
|
132
|
+
const targetLocal = record.access.restricted !== true || users.length + groups.length !== 1;
|
|
133
|
+
for (const user of users)
|
|
134
|
+
if (isRecord(user))
|
|
135
|
+
add('service-account', user.userId, targetLocal);
|
|
136
|
+
for (const group of groups)
|
|
137
|
+
if (isRecord(group))
|
|
138
|
+
add('group', group.groupId, targetLocal);
|
|
139
|
+
}
|
|
140
|
+
if (isRecord(record.memberships)) {
|
|
141
|
+
for (const [family, values] of [['group', record.memberships.groups], ['role-group', record.memberships.roleGroups]]) {
|
|
142
|
+
if (Array.isArray(values))
|
|
143
|
+
for (const value of values)
|
|
144
|
+
add(family, value, true);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
128
148
|
if (record.ownerType === 'GROUP')
|
|
129
149
|
add('group', record.ownerId);
|
|
130
150
|
if (record.ownerType === 'USER')
|
|
@@ -210,7 +230,10 @@ export function planWorkspacePrune(input) {
|
|
|
210
230
|
const removed = candidates.get(referenced);
|
|
211
231
|
// A managed retained consumer can release the old reference during upsert.
|
|
212
232
|
// An unmanaged or out-of-scope consumer must never be removed implicitly.
|
|
213
|
-
const preservesReference = desired && (
|
|
233
|
+
const preservesReference = desired && (reference.targetLocal
|
|
234
|
+
||
|
|
235
|
+
((target.resource === 'group' || target.resource === 'service-account')
|
|
236
|
+
&& (!isRecord(desired.owner) || !['group', 'service-account'].includes(String(desired.owner.type))))
|
|
214
237
|
|| (target.resource === 'job-template' && removed.resource === 'service-account' && !isRecord(desired.executionPrincipal)));
|
|
215
238
|
if (!desired || preservesReference || localReferences(target.resource, desired).some((ref) => key(ref.resource, ref.identity) === key(removed.resource, removed.stableKey))) {
|
|
216
239
|
blockers.push(`${removed.resource} "${removed.stableKey}" is still referenced by retained ${target.resource} "${target.stableKey || resourceIdOf(target.record)}".`);
|