## Summary - **Module reorganization**: Moved `ApplicationUpgradeService` and cron jobs to `application-upgrade/`, `ApplicationSyncService` to `application-manifest/`, and `runWorkspaceMigration`/`uninstallApplication` mutations to the manifest resolver — each module now has a single clear responsibility. - **Explicit install flow**: Removed implicit `ApplicationEntity` creation from `ApplicationSyncService`. The install service and dev resolver now explicitly create the `ApplicationEntity` before syncing. npm packages are resolved at registration time to extract manifest metadata (universalIdentifier, name, description, etc.), eliminating the `reconcileUniversalIdentifier` hack. - **Better error handling**: Frontend hooks now surface actual server error messages in snackbars instead of swallowing them. Replaced the ugly `ConfirmationModal` for transfer ownership with a proper form modal. Fixed `SettingsAdminTableCard` row height overflow and corrected the `yarn-engine` asset path. ## Test plan - [ ] Register an npm package — verify manifest metadata (name, description, universalIdentifier) is extracted correctly - [ ] Install a registered npm app on a workspace — verify ApplicationEntity is created and sync succeeds - [ ] Test `app:dev` CLI flow — verify local app registration and sync work - [ ] Upload a tarball — verify registration and install flow - [ ] Transfer ownership — verify the new modal UX works - [ ] Verify error messages appear correctly in snackbars when operations fail Made with [Cursor](https://cursor.com)
155 lines
4.3 KiB
TypeScript
155 lines
4.3 KiB
TypeScript
import {
|
|
createApplicationRegistrationVariableMutationFactory,
|
|
deleteApplicationRegistrationVariableMutationFactory,
|
|
findApplicationRegistrationVariablesQueryFactory,
|
|
updateApplicationRegistrationVariableMutationFactory,
|
|
} from 'test/integration/metadata/suites/application-registration-variable/utils/application-registration-variable-query-factories.util';
|
|
import { makeMetadataAPIRequest } from 'test/integration/metadata/suites/utils/make-metadata-api-request.util';
|
|
import { type CommonResponseBody } from 'test/integration/metadata/types/common-response-body.type';
|
|
import { warnIfErrorButNotExpectedToFail } from 'test/integration/metadata/utils/warn-if-error-but-not-expected-to-fail.util';
|
|
import { warnIfNoErrorButExpectedToFail } from 'test/integration/metadata/utils/warn-if-no-error-but-expected-to-fail.util';
|
|
|
|
import { type ApplicationRegistrationVariableEntity } from 'src/engine/core-modules/application/application-registration-variable/application-registration-variable.entity';
|
|
|
|
type VariableFields = Pick<
|
|
ApplicationRegistrationVariableEntity,
|
|
| 'id'
|
|
| 'key'
|
|
| 'description'
|
|
| 'isSecret'
|
|
| 'isRequired'
|
|
| 'isFilled'
|
|
| 'createdAt'
|
|
| 'updatedAt'
|
|
>;
|
|
|
|
const handleExpectation = (
|
|
response: { body: { errors?: unknown[]; data?: unknown } },
|
|
expectToFail: boolean | undefined,
|
|
operationName: string,
|
|
) => {
|
|
if (expectToFail === true) {
|
|
warnIfNoErrorButExpectedToFail({
|
|
response: response as never,
|
|
errorMessage: `${operationName} should have failed but did not`,
|
|
});
|
|
}
|
|
|
|
if (expectToFail === false) {
|
|
warnIfErrorButNotExpectedToFail({
|
|
response: response as never,
|
|
errorMessage: `${operationName} has failed but should not`,
|
|
});
|
|
}
|
|
};
|
|
|
|
export const findApplicationRegistrationVariables = async ({
|
|
applicationRegistrationId,
|
|
expectToFail,
|
|
token,
|
|
}: {
|
|
applicationRegistrationId: string;
|
|
expectToFail?: boolean;
|
|
token?: string;
|
|
}): CommonResponseBody<{
|
|
findApplicationRegistrationVariables: VariableFields[];
|
|
}> => {
|
|
const graphqlOperation = findApplicationRegistrationVariablesQueryFactory({
|
|
applicationRegistrationId,
|
|
});
|
|
|
|
const response = await makeMetadataAPIRequest(graphqlOperation, token);
|
|
|
|
handleExpectation(response, expectToFail, 'Find variables');
|
|
|
|
return { data: response.body.data, errors: response.body.errors };
|
|
};
|
|
|
|
export const createApplicationRegistrationVariable = async ({
|
|
applicationRegistrationId,
|
|
key,
|
|
value,
|
|
description,
|
|
isSecret,
|
|
expectToFail,
|
|
token,
|
|
}: {
|
|
applicationRegistrationId: string;
|
|
key: string;
|
|
value: string;
|
|
description?: string;
|
|
isSecret?: boolean;
|
|
expectToFail?: boolean;
|
|
token?: string;
|
|
}): CommonResponseBody<{
|
|
createApplicationRegistrationVariable: VariableFields;
|
|
}> => {
|
|
const graphqlOperation = createApplicationRegistrationVariableMutationFactory(
|
|
{
|
|
applicationRegistrationId,
|
|
key,
|
|
value,
|
|
description,
|
|
isSecret,
|
|
},
|
|
);
|
|
|
|
const response = await makeMetadataAPIRequest(graphqlOperation, token);
|
|
|
|
handleExpectation(response, expectToFail, 'Create variable');
|
|
|
|
return { data: response.body.data, errors: response.body.errors };
|
|
};
|
|
|
|
export const updateApplicationRegistrationVariable = async ({
|
|
id,
|
|
value,
|
|
description,
|
|
expectToFail,
|
|
token,
|
|
}: {
|
|
id: string;
|
|
value?: string;
|
|
description?: string;
|
|
expectToFail?: boolean;
|
|
token?: string;
|
|
}): CommonResponseBody<{
|
|
updateApplicationRegistrationVariable: VariableFields;
|
|
}> => {
|
|
const graphqlOperation = updateApplicationRegistrationVariableMutationFactory(
|
|
{
|
|
id,
|
|
value,
|
|
description,
|
|
},
|
|
);
|
|
|
|
const response = await makeMetadataAPIRequest(graphqlOperation, token);
|
|
|
|
handleExpectation(response, expectToFail, 'Update variable');
|
|
|
|
return { data: response.body.data, errors: response.body.errors };
|
|
};
|
|
|
|
export const deleteApplicationRegistrationVariable = async ({
|
|
id,
|
|
expectToFail,
|
|
token,
|
|
}: {
|
|
id: string;
|
|
expectToFail?: boolean;
|
|
token?: string;
|
|
}): CommonResponseBody<{
|
|
deleteApplicationRegistrationVariable: boolean;
|
|
}> => {
|
|
const graphqlOperation = deleteApplicationRegistrationVariableMutationFactory(
|
|
{ id },
|
|
);
|
|
|
|
const response = await makeMetadataAPIRequest(graphqlOperation, token);
|
|
|
|
handleExpectation(response, expectToFail, 'Delete variable');
|
|
|
|
return { data: response.body.data, errors: response.body.errors };
|
|
};
|