Job 1788385788361

Command: python -c "from pathlib import Path; p=Path(r'C:\Users\ash\PhoneBridgeCode.gs'); s=p.read_text(encoding='utf-8'); print('\n'.join(x for x in s.splitlines() if 'action' in x or x.startswith('function ') or 'QUEUE' in x or 'PropertiesService' in x))"
Directory: projects
Status: SUCCESS
Exit code: 0

Cancel Job Rerun Command Refresh

const MAX_QUEUE = 20;
function doGet(e) { return handle_(e, null); }
function doPost(e) {
function handle_(e, body) {
  const action=(body&&body.action)||p.action||'status';
    if (action==='status') return status_();
    if (action==='enqueue') return enqueue_(body||p);
    if (action==='poll') return poll_();
    if (action==='result') return result_(body||{});
    if (action==='heartbeat') return heartbeat_(body||{});
    if (action==='get_result') return getResult_(String((body&&body.command_id)||p.command_id||''));
    if (action==='queue') return out_({ok:true,queue:queue_()});
    return out_({ok:false,error:'unknown_action'});
function valid_(key) {
function queue_() {
  const s=PropertiesService.getScriptProperties().getProperty('QUEUE')||'[]';
function saveQueue_(q) {
  if (q.length>MAX_QUEUE) q=q.slice(q.length-MAX_QUEUE);
  PropertiesService.getScriptProperties().setProperty('QUEUE',JSON.stringify(q));
function enqueue_(x) {
  const act=String(x.command_action||x.cmd||'');
  if (!act) return out_({ok:false,error:'command_action_required'});
  q.push({id:id,action:act,payload_json:payload,status:'pending',target:String(x.target||TARGET),created_at:new Date().toISOString(),attempts:0});
function poll_() {
      return out_({ok:true,command:{row:i+1,id:q[i].id,action:q[i].action,payload_json:q[i].payload_json,attempts:q[i].attempts,target:q[i].target}});
function result_(b) {
function storeResult_(id,s) {
  const sp=PropertiesService.getScriptProperties(); const base='R_'+id+'_';
function getResult_(id) {
  const sp=PropertiesService.getScriptProperties(),base='R_'+id+'_',n=Number(sp.getProperty(base+'N')||0);
function heartbeat_(b) {
  const sp=PropertiesService.getScriptProperties();
function status_() {
  const sp=PropertiesService.getScriptProperties();
function out_(o) { return ContentService.createTextOutput(JSON.stringify(o)).setMimeType(ContentService.MimeType.JSON); }