Refactor/actions (#2733)

* store, properties, manifest

* interfaces

* init and backups

* fix init and backups

* file models

* more versions

* dependencies

* config except dynamic types

* clean up config

* remove disabled from non-dynamic vaues

* actions

* standardize example code block formats

* wip: actions refactor

Co-authored-by: Jade <Blu-J@users.noreply.github.com>

* commit types

* fix types

* update types

* update action request type

* update apis

* add description to actionrequest

* clean up imports

* revert package json

* chore: Remove the recursive to the index

* chore: Remove the other thing I was testing

* flatten action requests

* update container runtime with new config paradigm

* new actions strategy

* seems to be working

* misc backend fixes

* fix fe bugs

* only show breakages if breakages

* only show success modal if result

* don't panic on failed removal

* hide config from actions page

* polyfill autoconfig

* use metadata strategy for actions instead of prev

* misc fixes

* chore: split the sdk into 2 libs (#2736)

* follow sideload progress (#2718)

* follow sideload progress

* small bugfix

* shareReplay with no refcount false

* don't wrap sideload progress in RPCResult

* dont present toast

---------

Co-authored-by: Aiden McClelland <me@drbonez.dev>

* chore: Add the initial of the creation of the two sdk

* chore: Add in the baseDist

* chore: Add in the baseDist

* chore: Get the web and the runtime-container running

* chore: Remove the empty file

* chore: Fix it so the container-runtime works

---------

Co-authored-by: Matt Hill <MattDHill@users.noreply.github.com>
Co-authored-by: Aiden McClelland <me@drbonez.dev>

* misc fixes

* update todos

* minor clean up

* fix link script

* update node version in CI test

* fix node version syntax in ci build

* wip: fixing callbacks

* fix sdk makefile dependencies

* add support for const outside of main

* update apis

* don't panic!

* Chore: Capture weird case on rpc, and log that

* fix procedure id issue

* pass input value for dep auto config

* handle disabled and warning for actions

* chore: Fix for link not having node_modules

* sdk fixes

* fix build

* fix build

* fix build

---------

Co-authored-by: Matt Hill <mattnine@protonmail.com>
Co-authored-by: Jade <Blu-J@users.noreply.github.com>
Co-authored-by: J H <dragondef@gmail.com>
Co-authored-by: Jade <2364004+Blu-J@users.noreply.github.com>
Co-authored-by: Matt Hill <MattDHill@users.noreply.github.com>
This commit is contained in:
Aiden McClelland
2024-09-25 16:12:52 -06:00
committed by GitHub
parent eec5cf6b65
commit db0695126f
469 changed files with 16218 additions and 10485 deletions

View File

@@ -1,8 +1,8 @@
import { inject } from '@angular/core'
import { FormControlComponent } from './form-control/form-control.component'
import { CT } from '@start9labs/start-sdk'
import { IST } from '@start9labs/start-sdk'
export abstract class Control<Spec extends CT.ValueSpec, Value> {
export abstract class Control<Spec extends Exclude<IST.ValueSpec, IST.ValueSpecHidden>, Value> {
private readonly control: FormControlComponent<Spec, Value> =
inject(FormControlComponent)

View File

@@ -0,0 +1,15 @@
import { Pipe, PipeTransform } from '@angular/core'
import { IST } from '@start9labs/start-sdk'
import { KeyValue } from '@angular/common'
@Pipe({
name: 'filterHidden',
})
export class FilterHiddenPipe implements PipeTransform {
transform(value: KeyValue<string, IST.ValueSpec>[]) {
return value.filter(x => x.value.type !== 'hidden') as KeyValue<
string,
Exclude<IST.ValueSpec, IST.ValueSpecHidden>
>[]
}
}

View File

@@ -8,7 +8,7 @@ import {
tuiHeightCollapse,
} from '@taiga-ui/core'
import { TUI_PROMPT } from '@taiga-ui/kit'
import { CT } from '@start9labs/start-sdk'
import { IST } from '@start9labs/start-sdk'
import { filter, takeUntil } from 'rxjs'
import { FormService } from 'src/app/services/form.service'
import { ERRORS } from '../form-group/form-group.component'
@@ -22,7 +22,7 @@ import { ERRORS } from '../form-group/form-group.component'
})
export class FormArrayComponent {
@Input()
spec!: CT.ValueSpecList
spec!: IST.ValueSpecList
@HostBinding('@tuiParentAnimation')
readonly animation = { value: '', ...inject(TUI_ANIMATION_OPTIONS) }

View File

@@ -1,5 +1,5 @@
import { Component } from '@angular/core'
import { CT } from '@start9labs/start-sdk'
import { IST } from '@start9labs/start-sdk'
import { Control } from '../control'
import { MaskitoOptions } from '@maskito/core'
@@ -8,7 +8,7 @@ import { MaskitoOptions } from '@maskito/core'
templateUrl: './form-color.component.html',
styleUrls: ['./form-color.component.scss'],
})
export class FormColorComponent extends Control<CT.ValueSpecColor, string> {
export class FormColorComponent extends Control<IST.ValueSpecColor, string> {
readonly mask: MaskitoOptions = {
mask: ['#', ...Array(6).fill(/[0-9a-f]/i)],
}

View File

@@ -36,4 +36,4 @@
Accept
</button>
</div>
</ng-template>
</ng-template>

View File

@@ -13,7 +13,7 @@ import {
TuiNotification,
} from '@taiga-ui/core'
import { filter, takeUntil } from 'rxjs'
import { CT } from '@start9labs/start-sdk'
import { IST } from '@start9labs/start-sdk'
import { ERRORS } from '../form-group/form-group.component'
import { FORM_CONTROL_PROVIDERS } from './form-control.providers'
@@ -25,7 +25,7 @@ import { FORM_CONTROL_PROVIDERS } from './form-control.providers'
providers: FORM_CONTROL_PROVIDERS,
})
export class FormControlComponent<
T extends CT.ValueSpec,
T extends Exclude<IST.ValueSpec, IST.ValueSpecHidden>,
V,
> extends AbstractTuiNullableControl<V> {
@Input()

View File

@@ -1,6 +1,6 @@
import { forwardRef, Provider } from '@angular/core'
import { TUI_VALIDATION_ERRORS } from '@taiga-ui/kit'
import { CT } from '@start9labs/start-sdk'
import { IST } from '@start9labs/start-sdk'
import { FormControlComponent } from './form-control.component'
interface ValidatorsPatternError {
@@ -12,7 +12,7 @@ export const FORM_CONTROL_PROVIDERS: Provider[] = [
{
provide: TUI_VALIDATION_ERRORS,
deps: [forwardRef(() => FormControlComponent)],
useFactory: (control: FormControlComponent<CT.ValueSpec, string>) => ({
useFactory: (control: FormControlComponent<Exclude<IST.ValueSpec, IST.ValueSpecHidden>, string>) => ({
required: 'Required',
pattern: ({ requiredPattern }: ValidatorsPatternError) =>
('patterns' in control.spec &&

View File

@@ -6,7 +6,7 @@ import {
tuiPure,
TuiTime,
} from '@taiga-ui/cdk'
import { CT } from '@start9labs/start-sdk'
import { IST } from '@start9labs/start-sdk'
import { Control } from '../control'
@Component({
@@ -14,7 +14,7 @@ import { Control } from '../control'
templateUrl: './form-datetime.component.html',
})
export class FormDatetimeComponent extends Control<
CT.ValueSpecDatetime,
IST.ValueSpecDatetime,
string
> {
readonly min = TUI_FIRST_DAY

View File

@@ -1,5 +1,5 @@
<ng-container
*ngFor="let entry of spec | keyvalue : asIsOrder"
*ngFor="let entry of spec | keyvalue : asIsOrder | filterHidden"
tuiMode="onDark"
[ngSwitch]="entry.value.type"
[tuiTextfieldCleaner]="true"

View File

@@ -4,7 +4,7 @@ import {
Input,
ViewEncapsulation,
} from '@angular/core'
import { CT } from '@start9labs/start-sdk'
import { IST } from '@start9labs/start-sdk'
import { FORM_GROUP_PROVIDERS } from './form-group.providers'
export const ERRORS = [
@@ -27,7 +27,7 @@ export const ERRORS = [
viewProviders: [FORM_GROUP_PROVIDERS],
})
export class FormGroupComponent {
@Input() spec: CT.InputSpec = {}
@Input() spec: IST.InputSpec = {}
asIsOrder() {
return 0

View File

@@ -1,5 +1,5 @@
import { Component } from '@angular/core'
import { CT } from '@start9labs/start-sdk'
import { IST } from '@start9labs/start-sdk'
import { Control } from '../control'
import { tuiPure } from '@taiga-ui/cdk'
import { invert } from '@start9labs/shared'
@@ -9,7 +9,7 @@ import { invert } from '@start9labs/shared'
templateUrl: './form-multiselect.component.html',
})
export class FormMultiselectComponent extends Control<
CT.ValueSpecMultiselect,
IST.ValueSpecMultiselect,
readonly string[]
> {
private readonly inverted = invert(this.spec.values)

View File

@@ -1,11 +1,11 @@
import { Component } from '@angular/core'
import { CT } from '@start9labs/start-sdk'
import { IST } from '@start9labs/start-sdk'
import { Control } from '../control'
@Component({
selector: 'form-number',
templateUrl: './form-number.component.html',
})
export class FormNumberComponent extends Control<CT.ValueSpecNumber, number> {
export class FormNumberComponent extends Control<IST.ValueSpecNumber, number> {
protected readonly Infinity = Infinity
}

View File

@@ -7,7 +7,7 @@ import {
Output,
} from '@angular/core'
import { ControlContainer } from '@angular/forms'
import { CT } from '@start9labs/start-sdk'
import { IST } from '@start9labs/start-sdk'
@Component({
selector: 'form-object',
@@ -17,7 +17,7 @@ import { CT } from '@start9labs/start-sdk'
})
export class FormObjectComponent {
@Input()
spec!: CT.ValueSpecObject
spec!: IST.ValueSpecObject
@Input()
open = false

View File

@@ -1,5 +1,5 @@
import { Component } from '@angular/core'
import { CT } from '@start9labs/start-sdk'
import { IST } from '@start9labs/start-sdk'
import { invert } from '@start9labs/shared'
import { Control } from '../control'
@@ -7,7 +7,7 @@ import { Control } from '../control'
selector: 'form-select',
templateUrl: './form-select.component.html',
})
export class FormSelectComponent extends Control<CT.ValueSpecSelect, string> {
export class FormSelectComponent extends Control<IST.ValueSpecSelect, string> {
private readonly inverted = invert(this.spec.values)
readonly items = Object.values(this.spec.values)

View File

@@ -1,5 +1,5 @@
import { Component } from '@angular/core'
import { CT, utils } from '@start9labs/start-sdk'
import { IST, utils } from '@start9labs/start-sdk'
import { Control } from '../control'
@Component({
@@ -7,7 +7,7 @@ import { Control } from '../control'
templateUrl: './form-text.component.html',
styleUrls: ['./form-text.component.scss'],
})
export class FormTextComponent extends Control<CT.ValueSpecText, string> {
export class FormTextComponent extends Control<IST.ValueSpecText, string> {
masked = true
generate() {

View File

@@ -1,5 +1,5 @@
import { Component } from '@angular/core'
import { CT } from '@start9labs/start-sdk'
import { IST } from '@start9labs/start-sdk'
import { Control } from '../control'
@Component({
@@ -7,6 +7,6 @@ import { Control } from '../control'
templateUrl: './form-textarea.component.html',
})
export class FormTextareaComponent extends Control<
CT.ValueSpecTextarea,
IST.ValueSpecTextarea,
string
> {}

View File

@@ -1,5 +1,5 @@
import { Component } from '@angular/core'
import { CT } from '@start9labs/start-sdk'
import { IST } from '@start9labs/start-sdk'
import { Control } from '../control'
@Component({
@@ -7,4 +7,7 @@ import { Control } from '../control'
templateUrl: './form-toggle.component.html',
host: { class: 'g-toggle' },
})
export class FormToggleComponent extends Control<CT.ValueSpecToggle, boolean> {}
export class FormToggleComponent extends Control<
IST.ValueSpecToggle,
boolean
> {}

View File

@@ -6,7 +6,7 @@ import {
OnChanges,
} from '@angular/core'
import { ControlContainer, FormGroupName } from '@angular/forms'
import { CT } from '@start9labs/start-sdk'
import { IST } from '@start9labs/start-sdk'
import { FormService } from 'src/app/services/form.service'
import { tuiPure } from '@taiga-ui/cdk'
@@ -24,9 +24,9 @@ import { tuiPure } from '@taiga-ui/cdk'
})
export class FormUnionComponent implements OnChanges {
@Input()
spec!: CT.ValueSpecUnion
spec!: IST.ValueSpecUnion
selectSpec!: CT.ValueSpecSelect
selectSpec!: IST.ValueSpecSelect
private readonly form = inject(FormGroupName)
private readonly formService = inject(FormService)

View File

@@ -50,6 +50,7 @@ import { ControlDirective } from './control.directive'
import { FormColorComponent } from './form-color/form-color.component'
import { FormDatetimeComponent } from './form-datetime/form-datetime.component'
import { HintPipe } from './hint.pipe'
import { FilterHiddenPipe } from './filter-hidden.pipe'
@NgModule({
imports: [
@@ -101,6 +102,7 @@ import { HintPipe } from './hint.pipe'
MustachePipe,
HintPipe,
ControlDirective,
FilterHiddenPipe,
],
exports: [FormGroupComponent],
})

View File

@@ -1,11 +1,11 @@
import { Pipe, PipeTransform } from '@angular/core'
import { CT } from '@start9labs/start-sdk'
import { IST } from '@start9labs/start-sdk'
@Pipe({
name: 'hint',
})
export class HintPipe implements PipeTransform {
transform(spec: CT.ValueSpec): string {
transform(spec: Exclude<IST.ValueSpec, IST.ValueSpecHidden>): string {
const hint = []
if (spec.description) {