All files / app/mods/system script.ts

100% Statements 6/6
100% Branches 0/0
100% Functions 0/0
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100117x       117x                           117x                                                                                       117x                                 117x                       117x                
import { DateTime } from 'luxon';
import { Plugin } from '../../model/plugin';
import { Mod } from '../../model/tag';
 
export const runPlugin: Plugin = {
  tag: '+plugin/user/run',
  name: $localize`⌛️ Run Script`,
  config: {
    mod: $localize`➰️ Scripts`,
    version: 2,
    default: true,
    generated: $localize`Generated by jasper-ui ${DateTime.now().toISO()}`,
    icons: [{ label: $localize`⏳️`, order: -3 },],
    filters: [{ query: '+plugin/user/run', label: $localize`⏳️ running`, title: $localize`My running scripts`, group: $localize`Lists ☰` }],
    description: $localize`Schedule scripts to be run on the server at specific intervals.`,
  },
};
 
export const cronPlugin: Plugin = {
  tag: '+plugin/cron',
  name: $localize`⏱️ Scheduler`,
  config: {
    mod: $localize`➰️ Scripts`,
    version: 2,
    default: true,
    generated: $localize`Generated by jasper-ui ${DateTime.now().toISO()}`,
    icons: [{ label: $localize`⏱️`, order: -3 }],
    filters: [{ query: '+plugin/cron', label: $localize`⏱️ scheduled`, title: $localize`Scheduled script`, group: $localize`Plugins 🧰️` }],
    description: $localize`Schedule scripts to be run on the server at specific intervals.`,
    // language=Handlebars
    infoUi: `every {{formatInterval interval}}`,
    form: [{
      key: 'interval',
      type: 'duration',
      defaultValue: 'PT15M',
      props: {
        label: $localize`Interval:`,
        datalist: [
          { value: 'PT1M', label: $localize`1 min`},
          { value: 'PT5M', label: $localize`5 mins`},
          { value: 'PT15M', label: $localize`15 mins`},
          { value: 'PT30M', label: $localize`30 mins`},
          { value: 'PT30M', label: $localize`30 mins`},
          { value: 'PT1H', label: $localize`1 hour`},
          { value: 'PT2H', label: $localize`2 hours`},
          { value: 'PT6H', label: $localize`6 hours`},
          { value: 'PT12H', label: $localize`12 hours`},
          { value: 'PT24H', label: $localize`1 day`},
        ],
      }
    }],
  },
  defaults: {
    interval: 'PT15M',
  },
  schema: {
    properties: {
      interval: { type: 'string' },
    },
  },
};
 
export const deltaPlugin: Plugin = {
  tag: 'plugin/delta',
  name: $localize`⏳️ Delta`,
  config: {
    mod: $localize`➰️ Scripts`,
    version: 2,
    default: true,
    generated: $localize`Generated by jasper-ui ${DateTime.now().toISO()}`,
    description: $localize`Transform Refs by running scripts.`,
    icons: [
      { label: $localize`⏳️`, noResponse: '+plugin/delta', order: -10 },
      { tag: '_plugin/delta', label: $localize`⏳️`, noResponse: '+plugin/delta', order: -10 },
    ],
    filters: [{ query: 'plugin/delta|_plugin/delta', label: $localize`⏳️ working`, title: $localize`Running a script`, group: $localize`Plugins 🧰️` }],
  },
};
 
export const deltaSignaturePlugin: Plugin = {
  tag: '+plugin/delta',
  name: $localize`⏳️ Delta Signature`,
  config: {
    mod: $localize`➰️ Scripts`,
    version: 1,
    default: true,
    generated: $localize`Generated by jasper-ui ${DateTime.now().toISO()}`,
    description: $localize`Transform Refs by running scripts.`,
  },
};
 
export const scriptMod: Mod = {
  plugin: [
    runPlugin,
    cronPlugin,
    deltaPlugin,
    deltaSignaturePlugin,
  ]
};