| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "init": "{ |
| 5 | $nom_AA = 'Consultes'; |
| 6 | $versio = '0.1'; |
| 7 | |
| 8 | $args = trigger.data; |
| 9 | $_Portal = $args._Portal; |
| 10 | $refcons = $args.refcons; |
| 11 | $geto = $args.geto; |
| 12 | }", |
| 13 | "messages": [ |
| 14 | { |
| 15 | "app": "state", |
| 16 | "state": "{ |
| 17 | if ( $refcons == 'Portal' ) { |
| 18 | response[ '_Acces' ] = var[ $_Portal ][ '_Acces' ]; |
| 19 | response[ '_Getons' ] = var[ $_Portal ][ '_Getons' ]; |
| 20 | response[ '_Validacions' ] = var[ $_Portal ][ '_Validacions' ]; |
| 21 | response[ '_FRO' ] = var[ $_Portal ][ '_FRO' ]; |
| 22 | response[ '_FOP' ] = var[ $_Portal ][ '_FOP' ]; |
| 23 | response[ '_FDIP' ] = var[ $_Portal ][ '_FDIP' ]; |
| 24 | response[ '_Estels' ] = var[ $_Portal ][ 'id_Estels' ]; |
| 25 | response[ 'Interval' ] = var[ $_Portal ][ 'Interval' ]; |
| 26 | response[ 'Lapse' ] = var[ $_Portal ][ 'Lapse' ]; |
| 27 | response[ '_Transfer' ] = var[ $_Portal ][ '_Transfer' ]; |
| 28 | response[ '_Capacitacio' ] = var[ $_Portal ][ '_Capacitacio' ]; |
| 29 | response[ '_Avis' ] = var[ $_Portal ][ '_Avis' ]; |
| 30 | response[ 'Import_Activacio' ] = var[ $_Portal ][ 'Import_Activacio' ]; |
| 31 | response[ 'Import_Subscripcio' ] = var[ $_Portal ][ 'Import_Subscripcio' ]; |
| 32 | response[ 'Import_Renovacio' ] = var[ $_Portal ][ 'Import_Activacio' ]; |
| 33 | response[ 'Taxa_Conversio' ] = var[ $_Portal ][ 'Taxa_Conversio' ]; |
| 34 | response[ 'Factor_Conversio' ] = var[ $_Portal ][ 'Factor_Conversio' ]; |
| 35 | response[ 'Cicles_Latencia' ] = var[ $_Portal ][ 'Cicles_Latencia' ]; |
| 36 | response[ '_AUT_0' ] = var[ $_Portal ][ '_AUT_0' ]; |
| 37 | response[ '_AUT_A' ] = var[ $_Portal ][ '_AUT_A' ]; |
| 38 | response[ '_AUT_B' ] = var[ $_Portal ][ '_AUT_B' ]; |
| 39 | response[ '_AUT_C' ] = var[ $_Portal ][ '_AUT_C' ]; |
| 40 | } |
| 41 | if ( $refcons == 'Darrera_Proposta' ) { |
| 42 | $ref_ordinal = 'ordinal_proposta_' || $args.ref; |
| 43 | $ordinal = var[ $_Portal ][ $ref_ordinal ]; |
| 44 | $id_proposta = 'proposta_' || $args.ref || '_' || $ordinal; |
| 45 | $proposta = var[ $_Portal ][ $id_proposta ]; |
| 46 | |
| 47 | if ( !! $proposta ) { |
| 48 | $data_confirmacio = $proposta.temps + var[ $_Portal ][ 'Lapse' ]; |
| 49 | |
| 50 | response[ 'ref darrera proposta per a' || $args.ref ] = $id_proposta; |
| 51 | response[ 'ref del param proposat' ] = $proposta.ref; |
| 52 | response[ 'valor del param proposat' ] = $proposta.val; |
| 53 | response[ 'proposant' ] = $proposta.proposant; |
| 54 | response[ 'data de la proposta' ] = |
| 55 | timestamp_to_string( $proposta.temps ); |
| 56 | response[ 'data inici confirmacio' ] = |
| 57 | timestamp_to_string( $data_confirmacio ); |
| 58 | |
| 59 | $valor_actual = var[ $_Portal ][ $proposta.ref ]; |
| 60 | $coincident = |
| 61 | !! $valor_actual AND $valor_actual == $proposta.val ? 'SÍ' : 'NO'; |
| 62 | response[ 'valor actual coincident amb el proposat' ] = $coincident; |
| 63 | response[ 'valor actual' ] = $valor_actual; |
| 64 | |
| 65 | $_Validacions = var[ $_Portal ][ '_Validacions' ]; |
| 66 | $validacio = var[ $_Validacions ][ $id_proposta ]; |
| 67 | response[ 'proposta validada' ] = |
| 68 | !! $validacio ? timestamp_to_string( $validacio ) : 'NO'; |
| 69 | } else { |
| 70 | response[ 'No hi ha cap proposta per a aquest param genèric' ]= ''; |
| 71 | } |
| 72 | } |
| 73 | if ( $refcons == 'Validacio' ) { |
| 74 | $_AA = var[ $_Portal ][ '_Validacions' ]; |
| 75 | $data_validacio = var[ $_AA ][ $args.id ]; |
| 76 | response[ 'Proposta' ] = $args.id; |
| 77 | response[ 'Validada' ] = |
| 78 | !! $data_validacio ? timestamp_to_string( $data_validacio ) : 'NO'; |
| 79 | } |
| 80 | if ( $refcons == 'Dades_Geto' ) { |
| 81 | $_AA = var[ $_Portal ][ '_Getons' ]; |
| 82 | $ref_geto = 'geto_' || $args.id; |
| 83 | $estat = data_feed[[oracles = $_AA, feed_name = $ref_geto ]]; |
| 84 | $dades_registre = var[ $_AA ][ $args.id ]; |
| 85 | response[ 'Id getó' ] = $args.id; |
| 86 | response[ 'Estat' ] = $estat; |
| 87 | response[ 'Proposant' ] = $dades_registre.proposant; |
| 88 | response[ 'Confirmant' ] = $dades_registre.confirmant; |
| 89 | response[ 'Temps' ] = $dades_registre.temps; |
| 90 | |
| 91 | |
| 92 | } |
| 93 | if ( $refcons == 'Dades_Node' ) { |
| 94 | $_AA = var[ $_Portal ][ '_Transfer' ]; |
| 95 | $activacio = var[ $_AA ][ 'activacio_' || $args.adr || '_en_' || $geto ]; |
| 96 | $subscripcio = var[ $_AA ][ 'subscripcio_' || $args.adr || '_en_' || $geto ]; |
| 97 | $cicle_renovacio = var[ $_AA ][ 'renovacio_' || $args.adr__ || '_' || $geto ]; |
| 98 | $cicle_renovacio = var[ $_AA ][ 'cicle_' || $args.adr ]; |
| 99 | $total_Derivacions = var[ $_AA ][ 'total_Derivacions_de_' || $args.adr || '_en_' || $geto ]; |
| 100 | |
| 101 | $_Avis = var[ $_Portal ][ '_Avis' ]; |
| 102 | $avis = var[ $_Avis ][ 'Avis_' || $args.adr || '_' || $geto ]; |
| 103 | response[ 'Nom Activació' ] = $activacio.nom; |
| 104 | response[ 'Escala Activació' ] = $activacio.escala; |
| 105 | response[ 'Nom Subscripció' ] = $subscripcio.nom; |
| 106 | response[ '% Derivació a FOP' ] = $subscripcio.aFOP; |
| 107 | response[ 'Cicle Subscripció' ] = $subscripcio.cicle; |
| 108 | response[ 'Cicle Renovació' ] = $cicle_renovacio; |
| 109 | response[ 'Total Derivacions a FOP' ] = $total_Derivacions; |
| 110 | if ( !! $avis.operatiu ) { response[ 'Avís' ] = $avis.text; } |
| 111 | } |
| 112 | if ( $refcons == 'Totals' ) { |
| 113 | $_AA = var[ $_Portal ][ '_Transfer' ]; |
| 114 | $total_activacions = var[ $_AA ][ 'total_Activacions' || '_en_' || $geto ]; |
| 115 | $total_subscripcions = var[ $_AA ][ 'total_Subscripcions' || '_en_' || $geto ]; |
| 116 | $total_renovacions = var[ $_AA ][ 'total_Renovacions' || '_en_' || $geto ]; |
| 117 | $total_compensacions = var[ $_AA ][ 'total_Compensacions' || '_en_' || $geto ] ; |
| 118 | $total_derivacions = var[ $_AA ][ 'total_Derivacions' || '_en_' || $geto ]; |
| 119 | $total_diposits = var[ $_AA ][ 'total_Diposits' || '_en_' || $geto ]; |
| 120 | $total_liquidacions = var[ $_AA ][ 'total_Liquidacions' || '_en_' || $geto ]; |
| 121 | response[ 'Total Activacions' ] = $total_activacions; |
| 122 | response[ 'Total Subscripcions' ] = $total_subscripcions; |
| 123 | response[ 'Total Renovacions' ] = $total_renovacions; |
| 124 | response[ 'Total Compensacions' ] = $total_compensacions; |
| 125 | response[ 'Total Derivacions' ] = $total_derivacions; |
| 126 | response[ 'Total Diposits' ] = $total_diposits; |
| 127 | response[ 'Total Liquidacions' ] = $total_liquidacions; |
| 128 | } |
| 129 | if ( $refcons == 'Cicle_actual' ) { |
| 130 | $_AA = var[ $_Portal ][ '_Transfer' ]; |
| 131 | $cicle_actual = var[ $_AA ][ 'cicle_actual']; |
| 132 | $data_cicle_actual = var[ $_AA ][ 'data_cicle_actual']; |
| 133 | $data_cicle_anterior = var[ $_AA ][ 'data_cicle_anterior']; |
| 134 | $interval = var[ $_AA ][ 'Interval']; |
| 135 | response[ 'Cicle Actual' ] = $cicle_actual; |
| 136 | response[ 'Data Cicle Actual' ] = timestamp_to_string( $data_cicle_actual ); |
| 137 | response[ 'Data Cicle Anterior' ] = timestamp_to_string( $data_cicle_anterior ); |
| 138 | response[ 'Data Cicle Actual milisegons' ] = $data_cicle_actual; |
| 139 | response[ 'Data Cicle Anterior milisegons' ] = $data_cicle_anterior; |
| 140 | response[ 'Interval' ] = $interval; |
| 141 | } |
| 142 | if ( $refcons == '_Avis' ) { |
| 143 | $_AA = var[ $_Portal ][ '_Avis' ]; |
| 144 | $avis = var[ $_AA ][ 'Avis_' || $args.adr || '_' || $geto ]; |
| 145 | response[ 'Actuant' ] = $avis.actuant; |
| 146 | response[ 'Text' ] = $avis.text; |
| 147 | response[ 'Rebot' ] = $avis.rebot; |
| 148 | response[ 'Operatiu' ] = $avis.operatiu; |
| 149 | if ( !! $avis.data ) { |
| 150 | response[ 'Data' ] = timestamp_to_string( $avis.data ); |
| 151 | } |
| 152 | } |
| 153 | if ( $refcons == 'Capacitacio' ) { |
| 154 | $_AA = var[ $_Portal ][ '_Capacitacio' ]; |
| 155 | $ref = $args.tipus || '_' || $args.adr || '_' || $geto; |
| 156 | $capacitacio = var[ $_AA ][ $ref ]; |
| 157 | response[ 'Ref Capacitacio' ] = $ref; |
| 158 | response[ 'Ordinal' ] = $capacitacio.ordinal; |
| 159 | response[ 'Data' ] = timestamp_to_string( $capacitacio.data ); |
| 160 | response[ 'Estat' ] = $capacitacio.estat; |
| 161 | response[ 'Capacitadora' ] = $capacitacio.capacitadora; |
| 162 | } |
| 163 | |
| 164 | }" |
| 165 | } |
| 166 | ] |
| 167 | } |
| 168 | ] |