@runeditrun/rer 0.2.62 → 0.2.64
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 +48 -27
- package/cli/README.md +26 -2
- package/cli/business/api.mjs +40 -6
- package/cli/business/command.mjs +8 -6
- package/cli/business/connect.mjs +80 -44
- package/cli/business/device.mjs +20 -0
- package/cli/business/errors.mjs +26 -0
- package/cli/business/keychain.mjs +48 -17
- package/cli/business/local-commands.mjs +5 -7
- package/cli/business/opt-ins.mjs +13 -4
- package/cli/business/permissions.mjs +3 -1
- package/cli/business/policy.mjs +1 -1
- package/cli/business/scan-command.mjs +6 -3
- package/cli/business/service.mjs +6 -3
- package/cli/business/state.mjs +67 -10
- package/cli/business/vendors/README.md +13 -0
- package/cli/contract.mjs +2 -2
- package/cli/parse.mjs +2 -1
- package/global/CHANGELOG.md +11 -0
- package/global/README.md +48 -27
- package/modules/container/README.md +15 -1
- package/modules/dependencies/README.md +16 -1
- package/modules/erasure/README.md +15 -1
- package/modules/portability/README.md +17 -0
- package/onboarding/README.md +17 -2
- package/onboarding/schema/SETUP.schema.json +8 -0
- package/onboarding/schema/setup-validation.mjs +15 -1
- package/onboarding/setup-manifest.mjs +4 -3
- package/package.json +1 -1
|
@@ -6,6 +6,11 @@ export const SETUP_SCHEMA_ID = 'urn:rer:setup:1';
|
|
|
6
6
|
|
|
7
7
|
const PUBLIC_KINDS = new Set(['text', 'email', 'url', 'select', 'colour', 'timezone']);
|
|
8
8
|
|
|
9
|
+
/** Effective audience of a validated public field, including its group default. */
|
|
10
|
+
export function setupFieldAudience(field, groups) {
|
|
11
|
+
return field.audience ?? groups.find(group => group.id === field.group)?.audience ?? 'owner';
|
|
12
|
+
}
|
|
13
|
+
|
|
9
14
|
/** Match a validated condition against raw public input; whitespace is a value. */
|
|
10
15
|
export function setupConditionMatches(condition, values) {
|
|
11
16
|
const value = values[condition.field];
|
|
@@ -131,6 +136,7 @@ export function setupManifestSemanticErrors(data) {
|
|
|
131
136
|
if (field.group !== undefined && !groups.has(field.group)) fail(`${path}.group`, 'group must reference a declared group');
|
|
132
137
|
|
|
133
138
|
if (isSecret) {
|
|
139
|
+
if (Object.hasOwn(field, 'audience')) fail(`${path}.audience`, `${field.name}: secret fields cannot declare audience`);
|
|
134
140
|
for (const name of ['default', 'prefill', 'options', 'runtimeEditable']) {
|
|
135
141
|
if (Object.hasOwn(field, name)) fail(`${path}.${name}`, 'secret fields cannot declare public input metadata');
|
|
136
142
|
}
|
|
@@ -144,6 +150,9 @@ export function setupManifestSemanticErrors(data) {
|
|
|
144
150
|
fail(`${path}.ownerVisible`, 'only generated or explicitly entered secret values may be shown to the owner');
|
|
145
151
|
}
|
|
146
152
|
} else {
|
|
153
|
+
if (field.audience === 'owner' && groups.get(field.group)?.audience === 'developer') {
|
|
154
|
+
fail(`${path}.audience`, `${field.name} cannot declare owner audience inside developer group ${field.group}`);
|
|
155
|
+
}
|
|
147
156
|
for (const name of ['generate', 'ownerVisible', 'input']) {
|
|
148
157
|
if (Object.hasOwn(field, name)) fail(`${path}.${name}`, 'public fields cannot declare secret metadata');
|
|
149
158
|
}
|
|
@@ -320,6 +329,11 @@ export function validateSetupManifest(schema, data) {
|
|
|
320
329
|
if (schema?.$id !== SETUP_SCHEMA_ID) throw new Error('Expected setup schema version 1');
|
|
321
330
|
checkSchema(schema);
|
|
322
331
|
const errors = validate(schema, data);
|
|
323
|
-
if (errors.length) return errors
|
|
332
|
+
if (errors.length) return errors.map(error => {
|
|
333
|
+
const match = error.match(/^(\$\.(fields|groups)\[(\d+)\]\.audience):/);
|
|
334
|
+
if (!match) return error;
|
|
335
|
+
const item = data[match[2]][Number(match[3])];
|
|
336
|
+
return `${match[1]}: ${item.name ?? item.id} audience must be "owner" or "developer"`;
|
|
337
|
+
});
|
|
324
338
|
return setupManifestSemanticErrors(data);
|
|
325
339
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {parseSetupManifestBytes, validateSetupManifest, setupConditionMatches, validateSetupValue} from './schema/setup-validation.mjs';
|
|
1
|
+
import {parseSetupManifestBytes, validateSetupManifest, setupConditionMatches, validateSetupValue, setupFieldAudience} from './schema/setup-validation.mjs';
|
|
2
2
|
import {createModel} from './ui/model-core.mjs';
|
|
3
3
|
import {installerInputs} from './installer-inputs.mjs';
|
|
4
4
|
|
|
@@ -41,6 +41,7 @@ export function createInstallerModel(manifest,presentation={},options={}) {
|
|
|
41
41
|
for(const field of manifest.fields){
|
|
42
42
|
fields[field.name]={
|
|
43
43
|
...field,type:field.kind==='secret'?'password':field.kind==='colour'?'color':field.kind==='email'?'email':field.kind==='url'?'url':'text',
|
|
44
|
+
...(field.kind==='secret'?{}:{audience:setupFieldAudience(field,manifest.groups)}),
|
|
44
45
|
artwork:field.name===nameKey||['url','colour'].includes(field.kind),
|
|
45
46
|
autocomplete:field.kind==='secret'&&field.input==='entered'?'new-password':'off',
|
|
46
47
|
optional:!field.required,options:field.options?.map(option=>[option.value,option.label]),
|
|
@@ -55,7 +56,7 @@ export function createInstallerModel(manifest,presentation={},options={}) {
|
|
|
55
56
|
const groupIds=new Set(manifest.groups.map(group=>group.id));
|
|
56
57
|
const generatedId=preferred=>{let id=preferred,index=1;while(groupIds.has(id))id=preferred+'-'+index++;groupIds.add(id);return id;};
|
|
57
58
|
const groups=[...(manifest.fields.some(field=>!field.group)?[{id:generatedId('ungrouped'),title:manifest.title,keys:manifest.fields.filter(field=>!field.group).map(field=>field.name)}]:[]),
|
|
58
|
-
...manifest.groups.map(group=>({...group,title:group.label,keys:manifest.fields.filter(field=>field.group===group.id).map(field=>field.name)})),...own.groups.map(group=>({...group,id:generatedId(group.id)}))];
|
|
59
|
+
...manifest.groups.map(group=>({...group,audience:group.audience??'owner',title:group.label,keys:manifest.fields.filter(field=>field.group===group.id).map(field=>field.name)})),...own.groups.map(group=>({...group,id:generatedId(group.id)}))];
|
|
59
60
|
const safeKeys=Object.keys(fields).filter(key=>fields[key].type!=='password');
|
|
60
61
|
const defaults=Object.fromEntries(manifest.fields.filter(field=>field.kind!=='secret'&&field.default!==undefined).map(field=>[field.name,field.default]));
|
|
61
62
|
const internal={...presentation,product:presentation.product??{name:manifest.title},fields,safeKeys,secretScopes,setupGroups:groups,
|
|
@@ -69,7 +70,7 @@ export function createInstallerModel(manifest,presentation={},options={}) {
|
|
|
69
70
|
model.fieldDefinition=(key,draft)=>fields[key]?.definition?.(draft)??fields[key];
|
|
70
71
|
const originalSummaryKeys=model.summaryKeys;
|
|
71
72
|
model.summaryKeys=(draft,state)=>originalSummaryKeys(draft,state).filter(key=>model.fieldVisible(key,draft));
|
|
72
|
-
model.groupDefinition=(group,draft)=>{const variant=group.presentations?.find(item=>setupConditionMatches(item.when,draft));return {...group,...variant,title:variant?.label??group.title};};
|
|
73
|
+
model.groupDefinition=(group,draft)=>{const variant=group.presentations?.find(item=>setupConditionMatches(item.when,draft));return {...group,audience:group.audience??'owner',...variant,title:variant?.label??group.title};};
|
|
73
74
|
model.groupKeys=(group,draft)=>group.keys.filter(key=>model.fieldVisible(key,draft)).map((key,index)=>({key,index,order:model.fieldDefinition(key,draft).order??index})).sort((a,b)=>a.order-b.order||a.index-b.index).map(item=>item.key);
|
|
74
75
|
model.validateInput=(input,known={})=>{
|
|
75
76
|
if(!input||typeof input!=='object'||Array.isArray(input))throw Error('Provide setup inputs from rer-setup.json.');
|