PSA/ee/runner/wit/extension-runner.wit
Hermes 284313f908
Some checks are pending
Bidi Control Character Guard / bidi-control-guard (push) Waiting to run
Circular Dependency Check / Check for new circular dependencies (push) Waiting to run
Citus Migration Smoke / Combined migrations on single-node Citus (push) Waiting to run
E2E Fresh Install Tests / fresh-install-e2e (push) Waiting to run
ext-v2 guardrails / Run ext-v2 guard and ESLint (push) Waiting to run
Integration Tests / Check for relevant changes (push) Waiting to run
Integration Tests / ${{ (github.event_name == 'schedule' || github.event.inputs.suite == 'full') && 'Full integration suite' || 'Tier-1 integration subset' }} (push) Blocked by required conditions
Mobile checks / Mobile lint + typecheck (push) Waiting to run
Mobile checks / Mobile unit tests (push) Waiting to run
Mobile checks / Mobile dependency audit (report) (push) Waiting to run
Mobile checks / Mobile reproducibility checks (push) Waiting to run
Secrets guard (env backups) / Ensure no tracked env backup files (push) Waiting to run
Temporal Readiness / fast-readiness (push) Waiting to run
Temporal Readiness / docker-parity (push) Waiting to run
TypeScript Type Check / Nx affected typecheck (push) Waiting to run
Unit Tests / Skipped-test budget (push) Waiting to run
Unit Tests / Nx affected unit tests (push) Waiting to run
Unit Tests / Server unit coverage (informational) (push) Waiting to run
Validate Tenant Management Schema / Check for relevant changes (push) Waiting to run
Validate Tenant Management Schema / Validate Tenant Management Schema (push) Blocked by required conditions
EE Workflows Build Guard / ee-workflows-build-guard (push) Waiting to run
Initial import of AlgaPSA codebase from PSA server
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz

Source: /opt/alga-psa on psa.joliet.tech
2026-06-22 16:12:17 -05:00

385 lines
9.6 KiB
Plaintext

package alga:extension;
interface types {
record context-data {
request-id: option<string>,
tenant-id: string,
extension-id: string,
install-id: option<string>,
version-id: option<string>,
}
enum secret-error {
missing,
denied,
expired,
internal,
}
record http-header {
name: string,
value: string,
}
record http-request {
method: string,
url: string,
headers: list<http-header>,
body: option<list<u8>>,
}
record http-response {
status: u16,
headers: list<http-header>,
body: option<list<u8>>,
}
enum http-error {
invalid-url,
not-allowed,
transport,
internal,
}
enum storage-error {
missing,
conflict,
denied,
internal,
}
record storage-entry {
namespace: string,
key: string,
value: list<u8>,
revision: option<u64>,
}
enum proxy-error {
route-not-found,
denied,
bad-request,
internal,
}
record user-data {
tenant-id: string,
client-name: string,
user-id: string,
user-email: string,
user-name: string,
user-type: string,
}
record user-data-v2 {
tenant-id: string,
client-name: string,
user-id: string,
user-email: string,
user-name: string,
user-type: string,
client-id: option<string>,
additional-fields: list<tuple<string, string>>,
}
enum user-error {
not-available,
not-allowed,
}
// Scheduler types for cap:scheduler.manage
enum scheduler-error {
not-found,
validation-failed,
quota-exceeded,
denied,
internal,
}
record schedule-info {
id: string,
endpoint-path: string,
endpoint-method: string,
name: option<string>,
cron: string,
timezone: string,
enabled: bool,
payload: option<string>, // JSON-encoded
last-run-at: option<string>,
last-run-status: option<string>,
last-error: option<string>,
created-at: option<string>,
}
record endpoint-info {
id: string,
method: string,
path: string,
handler: string,
schedulable: bool,
}
record create-schedule-input {
endpoint: string,
cron: string,
timezone: option<string>,
enabled: option<bool>,
name: option<string>,
payload: option<string>, // JSON-encoded
}
record create-schedule-result {
success: bool,
schedule-id: option<string>,
error: option<string>,
field-errors: option<string>, // JSON-encoded map
}
record update-schedule-input {
endpoint: option<string>,
cron: option<string>,
timezone: option<string>,
enabled: option<bool>,
name: option<string>,
payload: option<string>, // JSON-encoded, use empty string to clear
}
record update-schedule-result {
success: bool,
error: option<string>,
field-errors: option<string>, // JSON-encoded map
}
record delete-schedule-result {
success: bool,
error: option<string>,
}
// Invoicing types for cap:invoice.manual.create
enum discount-type {
percentage,
fixed,
}
record manual-invoice-item-input {
service-id: string,
quantity: f64,
description: string,
rate: f64,
is-discount: option<bool>,
discount-type: option<discount-type>,
applies-to-item-id: option<string>,
applies-to-service-id: option<string>,
}
record create-manual-invoice-input {
client-id: string,
items: list<manual-invoice-item-input>,
invoice-date: option<string>, // YYYY-MM-DD
due-date: option<string>, // YYYY-MM-DD
po-number: option<string>,
}
record create-manual-invoice-result {
success: bool,
invoice-id: option<string>,
invoice-number: option<string>,
status: option<string>,
subtotal: option<f64>,
tax: option<f64>,
total: option<f64>,
error: option<string>,
field-errors: option<string>, // JSON-encoded map
}
enum client-read-error {
not-allowed,
invalid-input,
internal,
}
record client-summary {
client-id: string,
client-name: string,
client-type: option<string>,
is-inactive: bool,
default-currency-code: option<string>,
account-manager-id: option<string>,
account-manager-name: option<string>,
billing-email: option<string>,
}
record clients-list-input {
search: option<string>,
include-inactive: option<bool>,
page: option<u32>,
page-size: option<u32>,
}
record clients-list-result {
items: list<client-summary>,
total-count: u32,
page: u32,
page-size: u32,
}
enum service-item-kind {
service,
product,
}
enum service-billing-method {
fixed,
hourly,
usage,
}
enum service-read-error {
not-allowed,
invalid-input,
internal,
}
record service-summary {
service-id: string,
service-name: string,
item-kind: service-item-kind,
billing-method: service-billing-method,
service-type-id: option<string>,
service-type-name: option<string>,
default-rate: f64,
unit-of-measure: string,
is-active: bool,
sku: option<string>,
}
record services-list-input {
search: option<string>,
item-kind: option<service-item-kind>,
is-active: option<bool>,
billing-method: option<service-billing-method>,
page: option<u32>,
page-size: option<u32>,
}
record services-list-result {
items: list<service-summary>,
total-count: u32,
page: u32,
page-size: u32,
}
record execute-request {
context: context-data,
http: http-request,
}
record execute-response {
status: u16,
headers: list<http-header>,
body: option<list<u8>>,
}
}
interface context {
use types.{context-data};
get-context: func() -> context-data;
}
interface secrets {
use types.{secret-error};
get: func(key: string) -> result<string, secret-error>;
list-keys: func() -> list<string>;
}
interface http {
use types.{http-request, http-response, http-error};
fetch: func(request: http-request) -> result<http-response, http-error>;
}
interface storage {
use types.{storage-entry, storage-error};
get: func(namespace: string, key: string) -> result<storage-entry, storage-error>;
put: func(entry: storage-entry) -> result<storage-entry, storage-error>;
delete: func(namespace: string, key: string) -> result<_, storage-error>;
list-entries: func(namespace: string, cursor: option<string>) -> result<list<storage-entry>, storage-error>;
}
interface logging {
log-info: func(message: string);
log-warn: func(message: string);
log-error: func(message: string);
}
interface ui-proxy {
use types.{proxy-error};
call-route: func(route: string, payload: option<list<u8>>) -> result<list<u8>, proxy-error>;
}
interface user {
use types.{user-data, user-error};
get-user: func() -> result<user-data, user-error>;
}
interface user-v2 {
use types.{user-data-v2, user-error};
get-user: func() -> result<user-data-v2, user-error>;
}
interface scheduler {
use types.{
scheduler-error,
schedule-info,
endpoint-info,
create-schedule-input,
create-schedule-result,
update-schedule-input,
update-schedule-result,
delete-schedule-result
};
list-schedules: func() -> result<list<schedule-info>, scheduler-error>;
get-schedule: func(schedule-id: string) -> result<option<schedule-info>, scheduler-error>;
create-schedule: func(input: create-schedule-input) -> create-schedule-result;
update-schedule: func(schedule-id: string, input: update-schedule-input) -> update-schedule-result;
delete-schedule: func(schedule-id: string) -> delete-schedule-result;
get-endpoints: func() -> result<list<endpoint-info>, scheduler-error>;
}
interface invoicing {
use types.{create-manual-invoice-input, create-manual-invoice-result};
create-manual-invoice: func(input: create-manual-invoice-input) -> create-manual-invoice-result;
}
interface clients {
use types.{client-read-error, client-summary, clients-list-input, clients-list-result};
list-clients: func(input: clients-list-input) -> result<clients-list-result, client-read-error>;
get-client: func(client-id: string) -> result<option<client-summary>, client-read-error>;
}
interface services {
use types.{service-read-error, service-summary, services-list-input, services-list-result};
list-services: func(input: services-list-input) -> result<services-list-result, service-read-error>;
get-service: func(service-id: string) -> result<option<service-summary>, service-read-error>;
}
world runner {
use types.{execute-request, execute-response};
import context;
import secrets;
import http;
import storage;
import logging;
import ui-proxy;
import user;
import user-v2;
import scheduler;
import invoicing;
import clients;
import services;
export handler: func(request: execute-request) -> execute-response;
}