diff --git a/addons/api/addon/serializers/application.js b/addons/api/addon/serializers/application.js index f1e582cbb..f25f5d702 100644 --- a/addons/api/addon/serializers/application.js +++ b/addons/api/addon/serializers/application.js @@ -1,7 +1,6 @@ import RESTSerializer from '@ember-data/serializer/rest'; import { underscore } from '@ember/string'; import { get } from '@ember/object'; -import { copy } from 'ember-copy'; /** * Manages serialization/normalization of data to/from the API. @@ -129,7 +128,7 @@ export default class ApplicationSerializer extends RESTSerializer { ); // Copy the data rooted under `items` in the existing payload into the new // payload under the expected root key name. - transformedPayload[payloadKey] = copy(payload.items, true); + transformedPayload[payloadKey] = structuredClone(payload.items); // Return the result of normalizing the transformed payload. return super.normalizeArrayResponse( store, @@ -156,7 +155,7 @@ export default class ApplicationSerializer extends RESTSerializer { */ normalizeSingleResponse(store, primaryModelClass, payload, id, requestType) { // Copy payload (mostly to prevent mocking issues) - payload = copy(payload, true); + payload = structuredClone(payload); // Check for and normalize missing arrays payload = this.normalizeMissingArrays(store, primaryModelClass, payload); // Setup a new payload data structure. @@ -211,7 +210,7 @@ export default class ApplicationSerializer extends RESTSerializer { * @return {Object} */ normalize(typeClass, hash) { - let normalizedHash = copy(hash, true); + let normalizedHash = structuredClone(hash); const scopeID = get(normalizedHash, 'scope.id'); const scopeType = get(normalizedHash, 'scope.type'); if (scopeID) normalizedHash.scope.scope_id = scopeID; @@ -300,7 +299,7 @@ export default class ApplicationSerializer extends RESTSerializer { id, requestType ) { - const newPayload = copy(payload, true); + const newPayload = structuredClone(payload); primaryModelClass.attributes.forEach((attribute) => { const { diff --git a/addons/api/addon/serializers/auth-method.js b/addons/api/addon/serializers/auth-method.js index 22c01a247..9d8d8fada 100644 --- a/addons/api/addon/serializers/auth-method.js +++ b/addons/api/addon/serializers/auth-method.js @@ -1,6 +1,4 @@ import ApplicationSerializer from './application'; -import { copy } from 'ember-copy'; - export default class AuthMethodSerializer extends ApplicationSerializer { // =methods @@ -86,7 +84,7 @@ export default class AuthMethodSerializer extends ApplicationSerializer { * @return {Object} */ normalize(typeClass, hash, ...rest) { - let normalizedHash = copy(hash, true); + let normalizedHash = structuredClone(hash); // switch (normalizedHash.type) { // case 'oidc': // normalizedHash = this.normalizeOIDC(normalizedHash); diff --git a/addons/api/addon/serializers/credential-store.js b/addons/api/addon/serializers/credential-store.js index f715c7f97..74275dd96 100644 --- a/addons/api/addon/serializers/credential-store.js +++ b/addons/api/addon/serializers/credential-store.js @@ -1,6 +1,4 @@ import ApplicationSerializer from './application'; -import { copy } from 'ember-copy'; - export default class CredentialStoreSerializer extends ApplicationSerializer { /** * @override @@ -39,7 +37,7 @@ export default class CredentialStoreSerializer extends ApplicationSerializer { } normalize(typeClass, hash, ...rest) { - const normalizedHash = copy(hash, true); + const normalizedHash = structuredClone(hash); const normalized = super.normalize(typeClass, normalizedHash, ...rest); // Remove secret fields as we don't track them after being created/updated normalized.data.attributes.token = ''; diff --git a/addons/api/addon/serializers/credential.js b/addons/api/addon/serializers/credential.js index 02720040a..503b17019 100644 --- a/addons/api/addon/serializers/credential.js +++ b/addons/api/addon/serializers/credential.js @@ -1,6 +1,4 @@ import ApplicationSerializer from './application'; -import { copy } from 'ember-copy'; - export default class CredentialSerializer extends ApplicationSerializer { /** * @override @@ -33,7 +31,7 @@ export default class CredentialSerializer extends ApplicationSerializer { } normalize(typeClass, hash, ...rest) { - const normalizedHash = copy(hash, true); + const normalizedHash = structuredClone(hash); const normalized = super.normalize(typeClass, normalizedHash, ...rest); // Remove secret fields as we don't track them after being created/updated normalized.data.attributes.password = ''; diff --git a/addons/api/addon/serializers/host-set.js b/addons/api/addon/serializers/host-set.js index 4934be99f..ac5b05d2b 100644 --- a/addons/api/addon/serializers/host-set.js +++ b/addons/api/addon/serializers/host-set.js @@ -1,5 +1,4 @@ import ApplicationSerializer from './application'; -import { copy } from 'ember-copy'; const fieldByType = { aws: ['preferred_endpoints', 'filters', 'sync_interval_seconds'], @@ -88,7 +87,7 @@ export default class HostSetSerializer extends ApplicationSerializer { * TODO: remove once API consistently returns arrays. */ normalize(typeClass, hash, ...rest) { - const normalizedHash = copy(hash, true); + const normalizedHash = structuredClone(hash); if (typeof normalizedHash?.attributes?.filters === 'string') { normalizedHash.attributes.filters = [normalizedHash.attributes.filters]; diff --git a/addons/api/addon/serializers/managed-group.js b/addons/api/addon/serializers/managed-group.js index 0b15683d8..62910171f 100644 --- a/addons/api/addon/serializers/managed-group.js +++ b/addons/api/addon/serializers/managed-group.js @@ -1,6 +1,4 @@ import ApplicationSerializer from './application'; -import { copy } from 'ember-copy'; - export default class ManagedGroupSerializer extends ApplicationSerializer { // =properties @@ -21,7 +19,7 @@ export default class ManagedGroupSerializer extends ApplicationSerializer { } normalize(typeClass, hash, ...rest) { - const normalizedHash = copy(hash, true); + const normalizedHash = structuredClone(hash); if (normalizedHash?.attributes?.filter) { normalizedHash.attributes.filter_string = diff --git a/addons/api/mirage/helpers/permissions.js b/addons/api/mirage/helpers/permissions.js index ffda01359..a81a07c71 100644 --- a/addons/api/mirage/helpers/permissions.js +++ b/addons/api/mirage/helpers/permissions.js @@ -1,5 +1,3 @@ -import { copy } from 'ember-copy'; - /** * Allows development-time toggling of resource permissions via the window * querystring. Pass a JSON object into the query to toggle permissions. @@ -50,7 +48,7 @@ class ToggledCapabilities { */ authorizedActionsFor(field) { if (this.#authorizedActions[field]) { - return copy(this.#authorizedActions[field], true); + return structuredClone(this.#authorizedActions[field]); } } } diff --git a/addons/api/package.json b/addons/api/package.json index 728c17be1..12ebf1cc9 100644 --- a/addons/api/package.json +++ b/addons/api/package.json @@ -27,7 +27,6 @@ "ember-cli-babel": "^7.26.10", "ember-cli-htmlbars": "^6.1.0", "ember-cli-mirage": "^2.4.0", - "ember-copy": "^2.0.1", "ember-data": "~4.4.0", "ember-fetch": "^8.1.1" }, diff --git a/ui/admin/app/routes/scopes/scope/auth-methods/auth-method.js b/ui/admin/app/routes/scopes/scope/auth-methods/auth-method.js index f80e83b55..01d8dd4e7 100644 --- a/ui/admin/app/routes/scopes/scope/auth-methods/auth-method.js +++ b/ui/admin/app/routes/scopes/scope/auth-methods/auth-method.js @@ -2,8 +2,6 @@ import Route from '@ember/routing/route'; import { action } from '@ember/object'; import { notifySuccess, notifyError } from 'core/decorators/notify'; import { inject as service } from '@ember/service'; -import { copy } from 'ember-copy'; - export default class ScopesScopeAuthMethodsAuthMethodRoute extends Route { // =services @@ -36,19 +34,25 @@ export default class ScopesScopeAuthMethodsAuthMethodRoute extends Route { @action edit(authMethod) { if (authMethod.claims_scopes) { - authMethod.claims_scopes = copy(authMethod.claims_scopes, true); + authMethod.claims_scopes = structuredClone(authMethod.claims_scopes); } if (authMethod.signing_algorithms) { - authMethod.signing_algorithms = copy(authMethod.signing_algorithms, true); + authMethod.signing_algorithms = structuredClone( + authMethod.signing_algorithms + ); } if (authMethod.allowed_audiences) { - authMethod.allowed_audiences = copy(authMethod.allowed_audiences, true); + authMethod.allowed_audiences = structuredClone( + authMethod.allowed_audiences + ); } if (authMethod.idp_ca_certs) { - authMethod.idp_ca_certs = copy(authMethod.idp_ca_certs, true); + authMethod.idp_ca_certs = structuredClone(authMethod.idp_ca_certs); } if (authMethod.account_claim_maps) { - authMethod.account_claim_maps = copy(authMethod.account_claim_maps, true); + authMethod.account_claim_maps = structuredClone( + authMethod.account_claim_maps + ); } } diff --git a/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set.js b/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set.js index 4b81d1544..a61a0e990 100644 --- a/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set.js +++ b/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set.js @@ -1,8 +1,6 @@ import Route from '@ember/routing/route'; import { action } from '@ember/object'; import { inject as service } from '@ember/service'; -import { copy } from 'ember-copy'; - export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetRoute extends Route { // =services @@ -33,10 +31,12 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetRoute exte @action edit(hostSet) { if (hostSet.preferred_endpoints) { - hostSet.preferred_endpoints = copy(hostSet.preferred_endpoints, true); + hostSet.preferred_endpoints = structuredClone( + hostSet.preferred_endpoints + ); } if (hostSet.filters) { - hostSet.filters = copy(hostSet.filters, true); + hostSet.filters = structuredClone(hostSet.filters); } } diff --git a/yarn.lock b/yarn.lock index 545318685..01ebf64a2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13559,13 +13559,6 @@ ember-cookies@^0.5.0, ember-cookies@^0.5.2: ember-cli-babel "^7.1.0" ember-getowner-polyfill "^1.1.0 || ^2.0.0" -ember-copy@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/ember-copy/-/ember-copy-2.0.1.tgz#13192b12a250324bb4a8b4547a680b113f4e3041" - integrity sha512-N/XFvZszrzyyX4IcNoeK4mJvIItNuONumhPLqi64T8NDjJkxBj4Pq61rvMkJx/9eZ8alzE4I8vYKOLxT0FvRuQ== - dependencies: - ember-cli-babel "^7.22.1" - ember-data@~4.4.0: version "4.4.1" resolved "https://registry.yarnpkg.com/ember-data/-/ember-data-4.4.1.tgz#86e56d55b49986dff8ae1cc98a740c829e53961e"