git mv packages/business -> packages/organization (@mosaic/organization). The old package stays as one-line re-export shims of each moved module, with src/business.mjs re-exporting src/organization-config.mjs and src/cli.mjs forwarding to the moved executable. BusinessError is OrganizationConfigError (one constructor, name kept BusinessError); OrganizationError stays distinct. The bus adapter gains organization-context.mjs (busOrganization), with business.mjs (busBusiness) as the same function. Import consumers, manifests, the lockfile, scripts/mosaic, stack-copy.sh COPY_PATHS (both roots), seat sandbox RUNNER_FILES and the copy closure walker (organization-imports.mjs, both roots required) move to the new path. v1 serialization, v1 writers and the stage A fixtures are unchanged; the stage A contract tests stay where they were and pass as before.
37 lines
1.4 KiB
JavaScript
37 lines
1.4 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { busOrganization } from '../src/organization-context.mjs';
|
|
import { busBusiness } from '../src/business.mjs';
|
|
import * as bus from '../src/index.mjs';
|
|
test('S1 adapter takes resolved limits and refs, rejects mismatched instance, never mutates input', () => {
|
|
const business = {
|
|
id: 'demo',
|
|
human: 'jason',
|
|
roles: {
|
|
coder: { definition: 'coder', credentials: { gitea: { file: '/unused', rotateBy: '2099-01-01' } } },
|
|
},
|
|
};
|
|
const resolved = {
|
|
coder: {
|
|
business: 'demo',
|
|
instance: 'coder',
|
|
definition: 'coder',
|
|
limits: { authority: { withinRole: ['message.send'], crossRole: [] } },
|
|
credentials: {},
|
|
},
|
|
};
|
|
const before = structuredClone(business),
|
|
b = busOrganization(business, resolved);
|
|
assert.deepEqual(b.roles.coder.authority, resolved.coder.limits.authority);
|
|
assert.deepEqual(b.roles.coder.credentials, {});
|
|
assert.deepEqual(business, before);
|
|
resolved.coder.instance = 'pm';
|
|
assert.throws(() => busOrganization(business, resolved), /invalid-resolution/);
|
|
});
|
|
test('rename design r2 stage B: the old module and the package root give the same adapter function', () => {
|
|
assert.equal(typeof busOrganization, 'function');
|
|
assert.equal(busBusiness, busOrganization);
|
|
assert.equal(bus.busBusiness, busOrganization);
|
|
assert.equal(bus.busOrganization, busOrganization);
|
|
});
|