Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { alias } from "@ember/object/computed";
import { get, computed } from "@ember/object";
import attr from "ember-data/attr";
import Model from "ember-data/model";
import { belongsTo } from "ember-data/relationships";
import { fragment } from "ember-data-model-fragments/attributes";
import Moment from "moment";
export default Model.extend({
/** type {TwitchTicketProduct} */
product: fragment( "twitch-ticket-product", { defaultValue: {} } ),
/** type {TwitchTicketPurchaseProfile} */
purchase_profile: fragment( "twitch-ticket-purchase-profile", { defaultValue: {} } ),
/** @type ComputedProperty> */
partner_login: belongsTo( "twitch-user", { async: true } ),
access_end: attr( "date" ),
access_start: attr( "date" ),
expired: attr( "boolean" ),
is_gift: attr( "boolean" ),
/** @type ComputedProperty> */
channel: alias( "partner_login.channel" ),
// load the chained PromiseProxy
async loadChannel() {
const user = this.partner_login;
nodeClass: attr('string'),
isDraining: attr('boolean'),
schedulingEligibility: attr('string'),
status: attr('string'),
statusDescription: attr('string'),
shortId: shortUUIDProperty('id'),
modifyIndex: attr('number'),
// Available from single response
httpAddr: attr('string'),
tlsEnabled: attr('boolean'),
attributes: fragment('node-attributes'),
meta: fragment('node-attributes'),
resources: fragment('resources'),
reserved: fragment('resources'),
drainStrategy: fragment('drain-strategy'),
isEligible: equal('schedulingEligibility', 'eligible'),
address: computed('httpAddr', function() {
return ipParts(this.httpAddr).address;
}),
port: computed('httpAddr', function() {
return ipParts(this.httpAddr).port;
}),
isPartial: computed('httpAddr', function() {
return this.httpAddr == null;
}),
allocations: hasMany('allocations', { inverse: 'node' }),
name: attr('string'),
datacenter: attr('string'),
nodeClass: attr('string'),
isDraining: attr('boolean'),
schedulingEligibility: attr('string'),
status: attr('string'),
statusDescription: attr('string'),
shortId: shortUUIDProperty('id'),
modifyIndex: attr('number'),
// Available from single response
httpAddr: attr('string'),
tlsEnabled: attr('boolean'),
attributes: fragment('node-attributes'),
meta: fragment('node-attributes'),
resources: fragment('resources'),
reserved: fragment('resources'),
drainStrategy: fragment('drain-strategy'),
isEligible: equal('schedulingEligibility', 'eligible'),
address: computed('httpAddr', function() {
return ipParts(this.httpAddr).address;
}),
port: computed('httpAddr', function() {
return ipParts(this.httpAddr).port;
}),
isPartial: computed('httpAddr', function() {
return this.httpAddr == null;
}),
),
fooCycles: hasMany('foo-cycle', assign({ inverse: null }, options))
}),
'foo-transform': CopyableModel.extend({
property: attr('string'),
object: attr('object')
}),
'foo-fragment': Fragment.extend({
name: attr('string')
}),
'foo-fragment-holder': CopyableModel.extend({
foos: fragmentArray('fooFragment'),
bar: fragment('fooFragment')
}),
};
Object.keys(Models).forEach(name => {
let moduleName = `${config.modulePrefix}/models/${name}`;
if (requirejs.entries[moduleName]) {
requirejs.unsee(moduleName);
}
define(moduleName, [], () => ({ default: Models[name] }));
});
return Models;
}
import { get, set } from "@ember/object";
import { on } from "@ember/object/evented";
import attr from "ember-data/attr";
import Model from "ember-data/model";
import { fragment } from "ember-data-model-fragments/attributes";
/**
* @class Settings
*/
export default Model.extend({
advanced: attr( "boolean", { defaultValue: false } ),
gui: fragment( "settingsGui", { defaultValue: {} } ),
streaming: fragment( "settingsStreaming", { defaultValue: {} } ),
streams: fragment( "settingsStreams", { defaultValue: {} } ),
chat: fragment( "settingsChat", { defaultValue: {} } ),
notification: fragment( "settingsNotification", { defaultValue: {} } ),
init() {
this._super( ...arguments );
/*
* Define hasStreamsLanguagesSelection on the Settings model instead of the
* SettingsStreamsLanguages fragment, because we need to listen to the ready and didUpdate
* events of the Settings model.
* Use an object property descriptor to set enumerable to false, so that it is not included
* in the SettingsController's model object buffer.
*/
Object.defineProperty( this, "hasStreamsLanguagesSelection", {
enumerable: false,
writable: true,
import Fragment from "ember-data-model-fragments/fragment";
import { fragment } from "ember-data-model-fragments/attributes";
import { players as playersConfig } from "config";
import { typeKey } from "../player/fragment";
const attributes = {
"default": fragment( "settings-streaming-player", { defaultValue: {} } )
};
for ( const [ type ] of Object.entries( playersConfig ) ) {
attributes[ type ] = fragment( "settings-streaming-player", {
defaultValue: {
[ typeKey ]: `settings-streaming-player-${type}`
},
polymorphic: true,
typeKey
});
}
export default Fragment.extend( attributes );
export const ATTR_STREAMING_PLAYER_INPUT_STDIN = "stdin";
export const ATTR_STREAMING_PLAYER_INPUT_FIFO = "fifo";
export const ATTR_STREAMING_PLAYER_INPUT_HTTP = "http";
export const ATTR_STREAMING_PLAYER_INPUT_PASSTHROUGH = "passthrough";
export default Fragment.extend({
provider: attr( "string", { defaultValue: defaultProvider } ),
providers: fragment( "settingsStreamingProviders", { defaultValue: {} } ),
quality: attr( "string", { defaultValue: "source" } ),
qualities: fragment( "settingsStreamingQualities", { defaultValue: {} } ),
player: attr( "string", { defaultValue: "default" } ),
players: fragment( "settingsStreamingPlayers", { defaultValue: {} } ),
disable_ads: attr( "boolean", { defaultValue: false } ),
player_input: attr( "string", { defaultValue: ATTR_STREAMING_PLAYER_INPUT_STDIN } ),
player_no_close: attr( "boolean", { defaultValue: false } ),
hls_live_edge: attr( "number", { defaultValue: 3, min: 1, max: 10 } ),
hls_segment_threads: attr( "number", { defaultValue: 1, min: 1, max: 10 } ),
retry_open: attr( "number", { defaultValue: 1, min: 1, max: MAX } ),
retry_streams: attr( "number", { defaultValue: 1, min: 0, max: MAX } ),
providerName: computed( "provider", function() {
const provider = get( this, "provider" );
return providers[ provider ][ "name" ];
}),
providerType: computed( "provider", function() {
const provider = get( this, "provider" );
import Fragment from 'ember-data-model-fragments/fragment';
import { fragment } from 'ember-data-model-fragments/attributes';
export default class SidecarService extends Fragment {
@fragment('sidecar-proxy') proxy;
}
pending: 1,
running: 2,
complete: 3,
failed: 4,
lost: 5,
};
export default Model.extend({
token: service(),
shortId: shortUUIDProperty('id'),
job: belongsTo('job'),
node: belongsTo('node'),
name: attr('string'),
taskGroupName: attr('string'),
resources: fragment('resources'),
jobVersion: attr('number'),
modifyIndex: attr('number'),
modifyTime: attr('date'),
createIndex: attr('number'),
createTime: attr('date'),
clientStatus: attr('string'),
desiredStatus: attr('string'),
statusIndex: computed('clientStatus', function() {
return STATUS_ORDER[this.clientStatus] || 100;
}),
isRunning: equal('clientStatus', 'running'),
export const defaultProvider = isWin ? "streamlinkw" : "streamlink";
export const ATTR_STREAMING_PLAYER_INPUT_STDIN = "stdin";
export const ATTR_STREAMING_PLAYER_INPUT_FIFO = "fifo";
export const ATTR_STREAMING_PLAYER_INPUT_HTTP = "http";
export const ATTR_STREAMING_PLAYER_INPUT_PASSTHROUGH = "passthrough";
export default Fragment.extend({
provider: attr( "string", { defaultValue: defaultProvider } ),
providers: fragment( "settingsStreamingProviders", { defaultValue: {} } ),
quality: attr( "string", { defaultValue: "source" } ),
qualities: fragment( "settingsStreamingQualities", { defaultValue: {} } ),
player: attr( "string", { defaultValue: "default" } ),
players: fragment( "settingsStreamingPlayers", { defaultValue: {} } ),
disable_ads: attr( "boolean", { defaultValue: false } ),
player_input: attr( "string", { defaultValue: ATTR_STREAMING_PLAYER_INPUT_STDIN } ),
player_no_close: attr( "boolean", { defaultValue: false } ),
hls_live_edge: attr( "number", { defaultValue: 3, min: 1, max: 10 } ),
hls_segment_threads: attr( "number", { defaultValue: 1, min: 1, max: 10 } ),
retry_open: attr( "number", { defaultValue: 1, min: 1, max: MAX } ),
retry_streams: attr( "number", { defaultValue: 1, min: 0, max: MAX } ),
providerName: computed( "provider", function() {
const provider = get( this, "provider" );
return providers[ provider ][ "name" ];
}),