diff --git a/addon/models/driver.js b/addon/models/driver.js index 69017fe..d9ab67e 100644 --- a/addon/models/driver.js +++ b/addon/models/driver.js @@ -5,8 +5,6 @@ import { getOwner } from '@ember/application'; import { format as formatDate, isValid as isValidDate, formatDistanceToNow } from 'date-fns'; import isRelationMissing from '@fleetbase/ember-core/utils/is-relation-missing'; import isValidCoordinates from '@fleetbase/ember-core/utils/is-valid-coordinates'; -import isLatitude from '@fleetbase/ember-core/utils/is-latitude'; -import isLongitude from '@fleetbase/ember-core/utils/is-longitude'; import config from 'ember-get-config'; export default class DriverModel extends Model { @@ -123,26 +121,12 @@ export default class DriverModel extends Model { return formatDate(this.created_at, 'dd, MMM'); } - @computed('location') get latitude() { - if (this.location) { - let x = get(this.location, 'coordinates.0'); - let y = get(this.location, 'coordinates.1'); - - return isLatitude(x) ? x : y; - } - - return 0; - } - @computed('location') get longitude() { - if (this.location) { - let x = get(this.location, 'coordinates.0'); - let y = get(this.location, 'coordinates.1'); - - return isLongitude(y) ? y : x; - } + return get(this.location, 'coordinates.0'); + } - return 0; + @computed('location') get latitude() { + return get(this.location, 'coordinates.1'); } @computed('latitude', 'longitude') get coordinates() { @@ -150,6 +134,11 @@ export default class DriverModel extends Model { return [get(this, 'latitude'), get(this, 'longitude')]; } + @computed('latitude', 'longitude') get positionString() { + // eslint-disable-next-line ember/no-get + return `${get(this, 'latitude')} ${get(this, 'longitude')}`; + } + @computed('latitude', 'longitude') get latlng() { return { // eslint-disable-next-line ember/no-get @@ -168,7 +157,11 @@ export default class DriverModel extends Model { }; } - @computed('coordinates') get hasValidCoordinates() { + @computed('coordinates', 'latitude', 'longitude') get hasValidCoordinates() { + if (this.longitude === 0 || this.latitude === 0) { + return false; + } + return isValidCoordinates(this.coordinates); } diff --git a/addon/models/order.js b/addon/models/order.js index e4deb75..19c1361 100644 --- a/addon/models/order.js +++ b/addon/models/order.js @@ -7,6 +7,7 @@ import { isBlank } from '@ember/utils'; import { getOwner } from '@ember/application'; import { format as formatDate, formatDistanceToNow, isValid as isValidDate } from 'date-fns'; import isNotModel from '@fleetbase/ember-core/utils/is-not-model'; +import shouldNotLoadRelation from '../utils/should-not-load-relation'; export default class OrderModel extends Model { /** @ids */ @@ -51,6 +52,7 @@ export default class OrderModel extends Model { /** @attributes */ @attr('string') tracking; @attr('string') qr_code; + @attr('string') barcode; @attr('string') pickup_name; @attr('string') dropoff_name; @attr('string') driver_name; @@ -79,6 +81,8 @@ export default class OrderModel extends Model { @attr('boolean') facilitator_is_vendor; @attr('raw') meta; @attr('raw') options; + @attr('raw') tracker_data; + @attr('raw') eta; /** @dates */ @attr('date') scheduled_at; @@ -284,6 +288,10 @@ export default class OrderModel extends Model { return this.payload?.isMultiDrop; } + @computed('status') get hasActiveStatus() { + return this.status !== 'canceled' && this.status !== 'completed'; + } + @computed('has_driver_assigned', 'driver_assigned') get canLoadDriver() { return this.has_driver_assigned && !this.driver_assigned; } @@ -322,7 +330,6 @@ export default class OrderModel extends Model { } setProperties(this, { payload }); - return this; } @@ -353,7 +360,6 @@ export default class OrderModel extends Model { } setProperties(this, { meta }); - return this; } @@ -383,7 +389,6 @@ export default class OrderModel extends Model { } setProperties(this, { meta }); - return this; } @@ -408,7 +413,6 @@ export default class OrderModel extends Model { } setProperties(this, { meta: serializedMeta }); - return this; } @@ -425,165 +429,158 @@ export default class OrderModel extends Model { options.onBefore(this); } - return fetch.put(`orders/${this.id}`, properties, { normalizeToEmberData: true, normalizeModelType: 'order' }).then((order) => { - if (typeof options.onAfter === 'function') { - options.onAfter(order); - } - }); + const order = await fetch.put(`orders/${this.id}`, properties, { normalizeToEmberData: true, normalizeModelType: 'order' }); + if (typeof options.onAfter === 'function') { + options.onAfter(order); + } } async loadPayload(options = {}) { const owner = getOwner(this); const store = owner.lookup('service:store'); - - if (!this.payload_uuid || !isBlank(this.payload)) { + if (shouldNotLoadRelation(this, 'payload')) { return; } - return store - .queryRecord( - 'payload', - { - uuid: this.payload_uuid, - single: true, - with: ['pickup', 'dropoff', 'return', 'waypoints', 'entities'], - }, - options - ) - .then((payload) => { - this.set('payload', payload); - return payload; - }); + const payload = await store.queryRecord( + 'payload', + { + uuid: this.payload_uuid, + single: true, + with: ['pickup', 'dropoff', 'return', 'waypoints', 'entities'], + }, + options + ); + + this.set('payload', payload); + return payload; } async loadCustomer(options = {}) { const owner = getOwner(this); const store = owner.lookup('service:store'); + if (shouldNotLoadRelation(this, 'customer')) { + return; + } if (!this.customer_uuid || !isBlank(this.customer)) { return; } - return store.findRecord(`customer-${this.customer_type}`, this.customer_uuid, options).then((customer) => { - this.set('customer', customer); - return customer; - }); + const customer = await store.findRecord(`customer-${this.customer_type}`, this.customer_uuid, options); + this.set('customer', customer); + return customer; } async loadPurchaseRate(options = {}) { const owner = getOwner(this); const store = owner.lookup('service:store'); - - if (!this.purchase_rate_uuid || !isBlank(this.purchase_rate)) { + if (shouldNotLoadRelation(this, 'purchase_rate')) { return; } - return store.findRecord('purchase-rate', this.purchase_rate_uuid, options).then((purchaseRate) => { - this.set('purchase_rate', purchaseRate); - return purchaseRate; - }); + const purchaseRate = await store.findRecord('purchase-rate', this.purchase_rate_uuid, options); + this.set('purchase_rate', purchaseRate); + return purchaseRate; } async loadOrderConfig(options = {}) { const owner = getOwner(this); const store = owner.lookup('service:store'); - - if (!this.order_config_uuid || !isBlank(this.order_config)) { + if (shouldNotLoadRelation(this, 'order_config')) { return; } - return store.findRecord('order-config', this.order_config_uuid, options).then((orderConfig) => { - this.set('order_config', orderConfig); - return orderConfig; - }); + const orderConfig = await store.findRecord('order-config', this.order_config_uuid, options); + this.set('order_config', orderConfig); + return orderConfig; } async loadDriver(options = {}) { const owner = getOwner(this); const store = owner.lookup('service:store'); - - if (!this.driver_assigned_uuid || !isBlank(this.driver_assigned)) { + if (shouldNotLoadRelation(this, 'driver_assigned')) { return; } - return store.findRecord('driver', this.driver_assigned_uuid, options).then((driver) => { - this.set('driver_assigned', driver); - return driver; - }); + const driverAssigned = await store.findRecord('driver', this.driver_assigned_uuid, options); + this.set('driver_assigned', driverAssigned); + return driverAssigned; } async loadTrackingNumber(options = {}) { const owner = getOwner(this); const store = owner.lookup('service:store'); - - if (!this.tracking_number_uuid || !isBlank(this.tracking_number)) { + if (shouldNotLoadRelation(this, 'tracking_number')) { return; } - return store.findRecord('tracking-number', this.tracking_number_uuid, options).then((trackingNumber) => { - this.set('tracking_number', trackingNumber); - return trackingNumber; - }); + const trackingNumber = await store.findRecord('tracking-number', this.tracking_number_uuid, options); + this.set('tracking_number', trackingNumber); + return trackingNumber; } async loadTrackingActivity(options = {}) { const owner = getOwner(this); const store = owner.lookup('service:store'); - if (!this.tracking_number_uuid) { return; } - return store - .query( - 'tracking-status', - { - tracking_number_uuid: this.tracking_number_uuid, - }, - options - ) - .then((activity) => { - this.set('tracking_statuses', activity.toArray()); - return activity; - }); + const activity = await store.query( + 'tracking-status', + { + tracking_number_uuid: this.tracking_number_uuid, + }, + options + ); + + this.set('tracking_statuses', activity.toArray()); + return activity; } async loadComments(options = {}) { const owner = getOwner(this); const store = owner.lookup('service:store'); - return store - .query( - 'comment', - { - subject_uuid: this.id, - withoutParent: 1, - sort: '-created_at', - }, - options - ) - .then((comments) => { - this.set('comments', comments); - return comments; - }); + const comments = await store.query( + 'comment', + { + subject_uuid: this.id, + withoutParent: 1, + sort: '-created_at', + }, + options + ); + + this.set('comments', comments); + return comments; } async loadFiles(options = {}) { const owner = getOwner(this); const store = owner.lookup('service:store'); + const files = await store.query('file', { subject_uuid: this.id, sort: '-created_at' }, options); + + this.set('files', files); + return files; + } + + async loadTrackerData(params = {}, options = {}) { + const owner = getOwner(this); + const fetch = owner.lookup('service:fetch'); + const trackerData = await fetch.get(`orders/${this.id}/tracker`, params, options); + + this.set('tracker_data', trackerData); + return trackerData; + } + + async loadETA(params = {}, options = {}) { + const owner = getOwner(this); + const fetch = owner.lookup('service:fetch'); + const eta = await fetch.get(`orders/${this.id}/eta`, params, options); - return store - .query( - 'file', - { - subject_uuid: this.id, - sort: '-created_at', - }, - options - ) - .then((files) => { - this.set('files', files); - return files; - }); + this.set('eta', eta); + return eta; } } diff --git a/addon/models/payload.js b/addon/models/payload.js index 9995633..24d55f3 100644 --- a/addon/models/payload.js +++ b/addon/models/payload.js @@ -36,7 +36,7 @@ export default class PayloadModel extends Model { @notEmpty('return_uuid') hasReturn; @computed('waypoints.[]', 'pickup_uuid', 'dropoff_uuid') get isMultiDrop() { - return this.waypoints?.length > 0 && !this.pickup_uuid && !this.dropoff_uuid; + return this.waypoints.length > 0 && !this.pickup_uuid && !this.dropoff_uuid; } @computed('waypoints.firstObject') get firstWaypoint() { @@ -51,13 +51,11 @@ export default class PayloadModel extends Model { return this.waypoints.lastObject; } - @computed('current_waypoint_uuid', 'waypoints.@each.id') - get currentWaypoint() { + @computed('current_waypoint_uuid', 'waypoints.@each.id') get currentWaypoint() { return this.waypoints.find((waypoint) => waypoint.id === this.current_waypoint_uuid); } - @computed('currentWaypoint', 'firstWaypoint', 'isMultiDrop', 'dropoff') - get nextStop() { + @computed('currentWaypoint', 'firstWaypoint', 'isMultiDrop', 'dropoff') get nextStop() { const { currentWaypoint, firstWaypoint, isMultiDrop, dropoff } = this; if (isMultiDrop) { @@ -75,12 +73,40 @@ export default class PayloadModel extends Model { return middleWaypoints; } - @computed('updated_at') get updatedAgo() { - return formatDistanceToNow(this.updated_at); + @computed('entities', 'model.payload.{entities.[],waypoints.[]}', 'waypoints') get entitiesByDestination() { + const groups = []; + + // create groups + this.waypoints.forEach((waypoint) => { + const destinationId = waypoint.id; + if (destinationId) { + const entities = this.entities.filter((entity) => entity.destination_uuid === destinationId); + if (entities.length === 0) { + return; + } + + const group = { + destinationId, + waypoint, + entities, + }; + + groups.pushObject(group); + } + }); + + return groups; + } + + @computed('model.payload.waypoints', 'waypoints.toArray') get orderWaypoints() { + if (this.waypoints && typeof this.waypoints.toArray === 'function') { + return this.waypoints.toArray(); + } + + return this.waypoints; } - @computed('{dropoff,pickup,waypoints}', 'waypoints.[]') - get payloadCoordinates() { + @computed('{dropoff,pickup,waypoints}', 'waypoints.[]') get payloadCoordinates() { let waypoints = []; let coordinates = []; @@ -98,6 +124,29 @@ export default class PayloadModel extends Model { return coordinates; } + @computed('dropoff', 'model.payload.{dropoff,pickup,waypoints}', 'pickup', 'waypoints') get routeWaypoints() { + let waypoints = []; + let coordinates = []; + + waypoints.pushObjects([this.pickup, ...this.waypoints.toArray(), this.dropoff]); + waypoints.forEach((place) => { + if (place && place.get('longitude') && place.get('latitude')) { + if (place.hasInvalidCoordinates) { + return; + } + + coordinates.pushObject([place.get('latitude'), place.get('longitude')]); + } + }); + + return coordinates; + } + + /** computed dates */ + @computed('updated_at') get updatedAgo() { + return formatDistanceToNow(this.updated_at); + } + @computed('updated_at') get updatedAt() { return formatDate(this.updated_at, 'PPP p'); } diff --git a/addon/models/place.js b/addon/models/place.js index 38c03b6..428ce44 100644 --- a/addon/models/place.js +++ b/addon/models/place.js @@ -36,6 +36,7 @@ export default class PlaceModel extends Model { @attr('string') country_name; @attr('string') vendor_name; @attr('string') _import_id; + @attr('string') eta; @attr('point') location; @attr('raw') meta; @@ -90,6 +91,11 @@ export default class PlaceModel extends Model { return [get(this, 'latitude'), get(this, 'longitude')]; } + @computed('latitude', 'longitude') get positionString() { + // eslint-disable-next-line ember/no-get + return `${get(this, 'latitude')} ${get(this, 'longitude')}`; + } + @computed('latitude', 'longitude') get latlng() { return { // eslint-disable-next-line ember/no-get diff --git a/addon/models/service-quote-item.js b/addon/models/service-quote-item.js index 89c32ce..f474528 100644 --- a/addon/models/service-quote-item.js +++ b/addon/models/service-quote-item.js @@ -4,6 +4,7 @@ import { format as formatDate, isValid as isValidDate, formatDistanceToNow } fro export default class ServiceQuoteItemModel extends Model { /** @ids */ + @attr('string') public_id; @attr('string') service_quote_uuid; /** @attributes */ diff --git a/addon/models/service-quote.js b/addon/models/service-quote.js index fe4cb86..ea537a9 100644 --- a/addon/models/service-quote.js +++ b/addon/models/service-quote.js @@ -4,6 +4,7 @@ import { format as formatDate, isValid as isValidDate, formatDistanceToNow } fro export default class ServiceQuoteModel extends Model { /** @ids */ + @attr('string') public_id; @attr('string') request_id; @attr('string') service_rate_uuid; @attr('string') payload_uuid; @@ -15,6 +16,7 @@ export default class ServiceQuoteModel extends Model { @attr('string') service_rate_name; @attr('string') amount; @attr('string') currency; + @attr('raw') meta; /** @dates */ @attr('date') expired_at; diff --git a/addon/models/service-rate.js b/addon/models/service-rate.js index fb9fd26..19fcbe2 100644 --- a/addon/models/service-rate.js +++ b/addon/models/service-rate.js @@ -42,6 +42,7 @@ export default class ServiceRate extends Model { @attr('string') estimated_days; @attr('boolean') has_cod_fee; @attr('boolean') has_peak_hours_fee; + @attr('raw') meta; /** @dates */ @attr('date') deleted_at; diff --git a/addon/models/vehicle.js b/addon/models/vehicle.js index fe34947..a9faa39 100644 --- a/addon/models/vehicle.js +++ b/addon/models/vehicle.js @@ -1,8 +1,10 @@ import Model, { attr, belongsTo, hasMany } from '@ember-data/model'; import { get, computed } from '@ember/object'; +import { not } from '@ember/object/computed'; import { format as formatDate, isValid as isValidDate, formatDistanceToNow } from 'date-fns'; import { getOwner } from '@ember/application'; import isRelationMissing from '@fleetbase/ember-core/utils/is-relation-missing'; +import isValidCoordinates from '@fleetbase/ember-core/utils/is-valid-coordinates'; import config from 'ember-get-config'; export default class VehicleModel extends Model { @@ -100,6 +102,52 @@ export default class VehicleModel extends Model { return formatDate(this.created_at, 'dd, MMM'); } + @computed('location') get longitude() { + return get(this.location, 'coordinates.0'); + } + + @computed('location') get latitude() { + return get(this.location, 'coordinates.1'); + } + + @computed('latitude', 'longitude') get coordinates() { + // eslint-disable-next-line ember/no-get + return [get(this, 'latitude'), get(this, 'longitude')]; + } + + @computed('latitude', 'longitude') get positionString() { + // eslint-disable-next-line ember/no-get + return `${get(this, 'latitude')} ${get(this, 'longitude')}`; + } + + @computed('latitude', 'longitude') get latlng() { + return { + // eslint-disable-next-line ember/no-get + lat: get(this, 'latitude'), + // eslint-disable-next-line ember/no-get + lng: get(this, 'longitude'), + }; + } + + @computed('latitude', 'longitude') get latitudelongitude() { + return { + // eslint-disable-next-line ember/no-get + latitude: get(this, 'latitude'), + // eslint-disable-next-line ember/no-get + longitude: get(this, 'longitude'), + }; + } + + @computed('coordinates', 'latitude', 'longitude') get hasValidCoordinates() { + if (this.longitude === 0 || this.latitude === 0) { + return false; + } + + return isValidCoordinates(this.coordinates); + } + + @not('hasValidCoordinates') hasInvalidCoordinates; + /** @methods */ loadDriver() { const owner = getOwner(this); diff --git a/addon/utils/relation-is-loaded.js b/addon/utils/relation-is-loaded.js new file mode 100644 index 0000000..84789d7 --- /dev/null +++ b/addon/utils/relation-is-loaded.js @@ -0,0 +1,5 @@ +import { isBlank } from '@ember/utils'; + +export default function relationIsLoaded(model, relationship) { + return !isBlank(model[relationship]); +} diff --git a/addon/utils/should-not-load-relation.js b/addon/utils/should-not-load-relation.js new file mode 100644 index 0000000..cee9845 --- /dev/null +++ b/addon/utils/should-not-load-relation.js @@ -0,0 +1,7 @@ +import { isBlank } from '@ember/utils'; +import { underscore } from '@ember/string'; + +export default function shouldNotLoadRelation(model, relationship, relationshipId = null) { + relationshipId = relationshipId === null ? `${underscore(relationship)}_uuid` : relationshipId; + return isBlank(model[relationshipId]) || !isBlank(model[relationship]); +} diff --git a/app/utils/relation-is-loaded.js b/app/utils/relation-is-loaded.js new file mode 100644 index 0000000..6bf538a --- /dev/null +++ b/app/utils/relation-is-loaded.js @@ -0,0 +1 @@ +export { default } from '@fleetbase/fleetops-data/utils/relation-is-loaded'; diff --git a/app/utils/should-not-load-relation.js b/app/utils/should-not-load-relation.js new file mode 100644 index 0000000..a2d1c30 --- /dev/null +++ b/app/utils/should-not-load-relation.js @@ -0,0 +1 @@ +export { default } from '@fleetbase/fleetops-data/utils/should-not-load-relation'; diff --git a/package.json b/package.json index 3cd4a92..241b3f4 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "publish:github": "npm config set '@fleetbase:registry' https://npm.pkg.github.com/ && npm publish" }, "dependencies": { - "@fleetbase/ember-core": "^0.2.17", + "@fleetbase/ember-core": "^0.2.19", "@babel/core": "^7.23.2", "date-fns": "^2.29.3", "ember-cli-babel": "^8.2.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f3e1d2c..aed97db 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^7.23.2 version: 7.25.2 '@fleetbase/ember-core': - specifier: ^0.2.17 - version: 0.2.17(@ember/string@3.1.1)(@ember/test-helpers@3.3.1(@babel/core@7.25.2)(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.94.0))(webpack@5.94.0))(ember-resolver@11.0.1(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.94.0)))(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.94.0))(webpack@5.94.0) + specifier: ^0.2.19 + version: 0.2.19(@ember/string@3.1.1)(@ember/test-helpers@3.3.1(@babel/core@7.25.2)(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.94.0))(webpack@5.94.0))(ember-resolver@11.0.1(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.94.0)))(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.94.0))(eslint@8.57.0)(webpack@5.94.0) date-fns: specifier: ^2.29.3 version: 2.30.0 @@ -1034,8 +1034,8 @@ packages: resolution: {integrity: sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - '@fleetbase/ember-core@0.2.17': - resolution: {integrity: sha512-4xtkBYDOmLUD2kIFl90Rg+G4BS7BdTXB2jf654VzsWxtV6vhjiFOeMBn/BErT8wnx0Re/7jdcQ3sdrJjBf1gBg==} + '@fleetbase/ember-core@0.2.19': + resolution: {integrity: sha512-xXRBp+dqZ975bPyAxvxlw1K+kcVxu1XZ9/Db+eySNPS2ua+wswg8+KyegnU6hkJflDgFjo7xTqBL30WVrjRUiQ==} engines: {node: '>= 18'} '@formatjs/ecma402-abstract@2.0.0': @@ -1059,8 +1059,8 @@ packages: '@formatjs/intl-localematcher@0.5.4': resolution: {integrity: sha512-zTwEpWOzZ2CiKcB93BLngUX59hQkuZjT2+SAQEscSm52peDW/getsawMcWF1rGRpMCX6D7nSJA3CzJ8gn13N/g==} - '@formatjs/intl@2.10.4': - resolution: {integrity: sha512-56483O+HVcL0c7VucAS2tyH020mt9XTozZO67cwtGg0a7KWDukS/FzW3OnvaHmTHDuYsoPIzO+ZHVfU6fT/bJw==} + '@formatjs/intl@2.10.5': + resolution: {integrity: sha512-f9qPNNgLrh2KvoFvHGIfcPTmNGbyy7lyyV4/P6JioDqtTE7Akdmgt+ZzVndr+yMLZnssUShyTMXxM/6aV9eVuQ==} peerDependencies: typescript: ^4.7 || 5 peerDependenciesMeta: @@ -2511,8 +2511,8 @@ packages: resolution: {integrity: sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA==} engines: {node: '>=4'} - decorator-transforms@2.0.0: - resolution: {integrity: sha512-ETfQccGcotK01YJsoB0AGTdUp7kS9jI93mBzrRY5Oyo+bOJfa2UKTSjCNf+iRNwAWBmBKlbiCcyL4tkY4C4dZQ==} + decorator-transforms@2.2.2: + resolution: {integrity: sha512-NHCSJXOUQ29YFli1QzstXWo72EyASpoVx+s0YdkMwswpovf/iAJP580nD1tB0Ph9exvtbfWdVrSAloXrWVo1Xg==} deep-extend@0.6.0: resolution: {integrity: sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==} @@ -2872,8 +2872,8 @@ packages: resolution: {integrity: sha512-89oVHVJwmLDvGvAUWgS87KpBoRhy3aZ6U0Ql6HOmU4TrPkyaa8pM0W81wj9cIwjYprcQtN9EwzZMHnq46+oUyw==} engines: {node: 8.* || 10.* || >= 12} - ember-simple-auth@6.0.0: - resolution: {integrity: sha512-9SzSFApxZ74CD4UxIeTV+poIPeXcRLXWM60cMvC1SwTYjoc/p9DeQF0pVm6m1XV6uA3kPUzEsEn4/GeHc2YX1w==} + ember-simple-auth@6.1.0: + resolution: {integrity: sha512-LhOl7TrOKlqb+0a/5STOoTSncDNuPELuFZ9+1SLduVX7DtdQr8VOEAmB8UaOnG0clJ9Bj6E3SczhXGjqd718Lw==} peerDependencies: '@ember/test-helpers': '>= 3 || > 2.7' peerDependenciesMeta: @@ -6072,18 +6072,6 @@ packages: utf-8-validate: optional: true - ws@8.18.0: - resolution: {integrity: sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==} - engines: {node: '>=10.0.0'} - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: '>=5.0.2' - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - xdg-basedir@4.0.0: resolution: {integrity: sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==} engines: {node: '>=8'} @@ -7349,7 +7337,7 @@ snapshots: '@eslint/js@8.57.0': {} - '@fleetbase/ember-core@0.2.17(@ember/string@3.1.1)(@ember/test-helpers@3.3.1(@babel/core@7.25.2)(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.94.0))(webpack@5.94.0))(ember-resolver@11.0.1(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.94.0)))(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.94.0))(webpack@5.94.0)': + '@fleetbase/ember-core@0.2.19(@ember/string@3.1.1)(@ember/test-helpers@3.3.1(@babel/core@7.25.2)(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.94.0))(webpack@5.94.0))(ember-resolver@11.0.1(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.94.0)))(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.94.0))(eslint@8.57.0)(webpack@5.94.0)': dependencies: '@babel/core': 7.25.2 compress-json: 3.1.0 @@ -7367,7 +7355,7 @@ snapshots: ember-intl: 6.3.2(@babel/core@7.25.2)(webpack@5.94.0) ember-loading: 2.0.0(@babel/core@7.25.2) ember-local-storage: 2.0.7(@babel/core@7.25.2) - ember-simple-auth: 6.0.0(@ember/test-helpers@3.3.1(@babel/core@7.25.2)(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.94.0))(webpack@5.94.0)) + ember-simple-auth: 6.1.0(@babel/core@7.25.2)(@ember/test-helpers@3.3.1(@babel/core@7.25.2)(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.94.0))(webpack@5.94.0))(eslint@8.57.0) ember-wormhole: 0.6.0 socketcluster-client: 17.2.2 transitivePeerDependencies: @@ -7377,6 +7365,7 @@ snapshots: - bufferutil - ember-resolver - ember-source + - eslint - supports-color - typescript - utf-8-validate @@ -7418,7 +7407,7 @@ snapshots: dependencies: tslib: 2.7.0 - '@formatjs/intl@2.10.4': + '@formatjs/intl@2.10.5': dependencies: '@formatjs/ecma402-abstract': 2.0.0 '@formatjs/fast-memoize': 2.2.0 @@ -9148,7 +9137,7 @@ snapshots: dependencies: mimic-response: 1.0.1 - decorator-transforms@2.0.0(@babel/core@7.25.2): + decorator-transforms@2.2.2(@babel/core@7.25.2): dependencies: '@babel/plugin-syntax-decorators': 7.24.7(@babel/core@7.25.2) babel-import-util: 3.0.0 @@ -9309,7 +9298,7 @@ snapshots: dependencies: '@ember/string': 3.1.1 '@embroider/addon-shim': 1.8.9 - decorator-transforms: 2.0.0(@babel/core@7.25.2) + decorator-transforms: 2.2.2(@babel/core@7.25.2) ember-inflector: 4.0.3(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.94.0)) ember-resolver: 11.0.1(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.94.0)) ember-source: 5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.94.0) @@ -9920,7 +9909,7 @@ snapshots: ember-intl@6.3.2(@babel/core@7.25.2)(webpack@5.94.0): dependencies: '@formatjs/icu-messageformat-parser': 2.7.8 - '@formatjs/intl': 2.10.4 + '@formatjs/intl': 2.10.5 broccoli-caching-writer: 3.0.3 broccoli-funnel: 3.0.8 broccoli-merge-files: 0.8.0 @@ -10019,8 +10008,9 @@ snapshots: transitivePeerDependencies: - supports-color - ember-simple-auth@6.0.0(@ember/test-helpers@3.3.1(@babel/core@7.25.2)(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.94.0))(webpack@5.94.0)): + ember-simple-auth@6.1.0(@babel/core@7.25.2)(@ember/test-helpers@3.3.1(@babel/core@7.25.2)(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.94.0))(webpack@5.94.0))(eslint@8.57.0): dependencies: + '@babel/eslint-parser': 7.25.1(@babel/core@7.25.2)(eslint@8.57.0) '@ember/test-waiters': 3.1.0 '@embroider/addon-shim': 1.8.9 '@embroider/macros': 1.16.6 @@ -10030,7 +10020,9 @@ snapshots: optionalDependencies: '@ember/test-helpers': 3.3.1(@babel/core@7.25.2)(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.94.0))(webpack@5.94.0) transitivePeerDependencies: + - '@babel/core' - '@glint/template' + - eslint - supports-color ember-source-channel-url@3.0.0: @@ -13016,7 +13008,7 @@ snapshots: stream-demux: 8.1.0 uuid: 8.3.2 vinyl-buffer: 1.0.1 - ws: 8.18.0 + ws: 8.17.1 transitivePeerDependencies: - bufferutil - utf-8-validate @@ -13866,8 +13858,6 @@ snapshots: ws@8.17.1: {} - ws@8.18.0: {} - xdg-basedir@4.0.0: {} xtend@4.0.2: {} diff --git a/tests/unit/utils/relation-is-loaded-test.js b/tests/unit/utils/relation-is-loaded-test.js new file mode 100644 index 0000000..42abf0e --- /dev/null +++ b/tests/unit/utils/relation-is-loaded-test.js @@ -0,0 +1,10 @@ +import relationIsLoaded from 'dummy/utils/relation-is-loaded'; +import { module, test } from 'qunit'; + +module('Unit | Utility | relation-is-loaded', function () { + // TODO: Replace this with your real tests. + test('it works', function (assert) { + let result = relationIsLoaded(); + assert.ok(result); + }); +}); diff --git a/tests/unit/utils/should-not-load-relation-test.js b/tests/unit/utils/should-not-load-relation-test.js new file mode 100644 index 0000000..7ec8209 --- /dev/null +++ b/tests/unit/utils/should-not-load-relation-test.js @@ -0,0 +1,10 @@ +import shouldNotLoadRelation from 'dummy/utils/should-not-load-relation'; +import { module, test } from 'qunit'; + +module('Unit | Utility | should-not-load-relation', function () { + // TODO: Replace this with your real tests. + test('it works', function (assert) { + let result = shouldNotLoadRelation(); + assert.ok(result); + }); +});