@synopackageland/cli 0.4.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -3
- package/dist/authorization-sdk.d.ts +5 -0
- package/dist/authorization-sdk.js +5 -0
- package/dist/build-spk/delete-app-data.d.ts +27 -7
- package/dist/build-spk/delete-app-data.js +35 -34
- package/dist/build-spk/dsm-arch.d.ts +6 -1
- package/dist/build-spk/dsm-arch.js +25 -1
- package/dist/build-spk/dsm-version.d.ts +14 -0
- package/dist/build-spk/dsm-version.js +47 -0
- package/dist/build-spk/gateway.d.ts +31 -0
- package/dist/build-spk/gateway.js +55 -0
- package/dist/build-spk/generator.d.ts +5 -0
- package/dist/build-spk/generator.js +103 -107
- package/dist/build-spk/install-wizard.d.ts +20 -0
- package/dist/build-spk/install-wizard.js +76 -0
- package/dist/build-spk/native-lifecycle.d.ts +5 -0
- package/dist/build-spk/native-lifecycle.js +12 -2
- package/dist/build-spk/resource-worker.d.ts +9 -4
- package/dist/build-spk/resource-worker.js +15 -6
- package/dist/build-spk/share-combobox.d.ts +3 -0
- package/dist/build-spk/share-combobox.js +27 -0
- package/dist/build-spk/uninstall-wizard.d.ts +14 -0
- package/dist/build-spk/uninstall-wizard.js +33 -0
- package/dist/build-spk/wizard-i18n.d.ts +18 -0
- package/dist/build-spk/wizard-i18n.js +38 -0
- package/dist/build-spk/wizard-messages.d.ts +388 -0
- package/dist/build-spk/wizard-messages.js +387 -0
- package/dist/cli.js +132 -32
- package/dist/compose/analyze.d.ts +20 -0
- package/dist/compose/analyze.js +75 -11
- package/dist/contract/validate.js +33 -1
- package/dist/contract/web-launch.d.ts +22 -0
- package/dist/contract/web-launch.js +37 -0
- package/dist/deploy/deploy.d.ts +3 -0
- package/dist/deploy/deploy.js +11 -2
- package/dist/error-registry.js +62 -3
- package/dist/host/dsm-port-profile.d.ts +1 -1
- package/dist/host/dsm-port-profile.js +1 -1
- package/dist/host/open-url.d.ts +2 -0
- package/dist/host/open-url.js +4 -1
- package/dist/images/pin.d.ts +52 -0
- package/dist/images/pin.js +249 -0
- package/dist/init.d.ts +27 -3
- package/dist/init.js +126 -16
- package/dist/inspect.d.ts +3 -0
- package/dist/inspect.js +15 -3
- package/dist/standalone/authorization-window.d.ts +2 -0
- package/dist/standalone/authorization-window.js +28 -0
- package/dist/standalone/authorization.d.ts +48 -0
- package/dist/standalone/authorization.js +116 -0
- package/dist/standalone/background.d.ts +21 -0
- package/dist/standalone/background.js +52 -0
- package/dist/standalone/binary.d.ts +1 -0
- package/dist/standalone/binary.js +1 -1
- package/dist/standalone/build.d.ts +2 -0
- package/dist/standalone/build.js +54 -10
- package/dist/standalone/dsm-window.js +10 -3
- package/dist/standalone/helper-inventory.d.ts +15 -0
- package/dist/standalone/helper-inventory.js +9 -0
- package/dist/standalone/helper.d.ts +1 -0
- package/dist/standalone/helper.js +29 -11
- package/dist/standalone/host-adapter.d.ts +1 -1
- package/dist/standalone/host-adapter.js +33 -15
- package/dist/standalone/host-file-navigation.d.ts +7 -0
- package/dist/standalone/host-file-navigation.js +172 -0
- package/dist/standalone/inspect-helper.js +21 -6
- package/dist/standalone/inspect-spk.d.ts +1 -1
- package/dist/standalone/inspect-spk.js +211 -7
- package/dist/standalone/job-diagnostics.d.ts +1 -0
- package/dist/standalone/job-diagnostics.js +49 -0
- package/dist/standalone/lifecycle-helper.d.ts +1 -1
- package/dist/standalone/lifecycle-helper.js +2 -2
- package/dist/standalone/lifecycle.d.ts +1 -1
- package/dist/standalone/lifecycle.js +14 -4
- package/dist/standalone/manifest.d.ts +15 -2
- package/dist/standalone/manifest.js +37 -6
- package/dist/standalone/native-layout.d.ts +74 -0
- package/dist/standalone/native-layout.js +318 -0
- package/dist/standalone/resource.d.ts +11 -0
- package/dist/standalone/resource.js +13 -0
- package/dist/standalone/root-ops.d.ts +2 -0
- package/dist/standalone/root-ops.js +10 -0
- package/dist/standalone/root-window.d.ts +3 -1
- package/dist/standalone/root-window.js +156 -38
- package/dist/standalone/shared-folder.d.ts +39 -0
- package/dist/standalone/shared-folder.js +141 -0
- package/dist/standalone/spk.d.ts +4 -0
- package/dist/standalone/spk.js +47 -3
- package/dist/standalone/worker-contract-json.d.ts +8 -0
- package/dist/standalone/worker-contract-json.js +141 -0
- package/dist/standalone/worker-contract.d.ts +189 -0
- package/dist/standalone/worker-contract.js +175 -0
- package/dist/standalone/worker-registry.d.ts +40 -0
- package/dist/standalone/worker-registry.js +167 -0
- package/dist/templates/_authorization/main.go +104 -0
- package/dist/templates/_authorization/main_test.go +35 -0
- package/dist/templates/_daemon/go.mod +2 -0
- package/dist/templates/_gateway/auth.go +101 -0
- package/dist/templates/_gateway/auth_test.go +216 -0
- package/dist/templates/_gateway/cgi.go +133 -0
- package/dist/templates/_gateway/cgi_test.go +156 -0
- package/dist/templates/_gateway/csrf.go +73 -0
- package/dist/templates/_gateway/csrf_test.go +155 -0
- package/dist/templates/_gateway/directory.go +108 -0
- package/dist/templates/_gateway/directory_test.go +202 -0
- package/dist/templates/_gateway/gateway.go +412 -0
- package/dist/templates/_gateway/gateway_test.go +676 -0
- package/dist/templates/_gateway/go.mod +3 -0
- package/dist/templates/_gateway/groups.go +66 -0
- package/dist/templates/_gateway/main.go +45 -0
- package/dist/templates/binary/synology-app.yaml +1 -1
- package/dist/templates/compose-import/compose.yaml +1 -1
- package/dist/templates/compose-import/synology-app.yaml +1 -1
- package/dist/templates/hello-files/compose.yaml +1 -1
- package/dist/templates/hello-files/synology-app.yaml +1 -1
- package/dist/templates/native-go/README.md +118 -5
- package/dist/templates/native-go/backend/THIRD_PARTY_NOTICES.txt +3 -1
- package/dist/templates/native-go/backend/cmd/app/main.go +25 -6
- package/dist/templates/native-go/backend/cmd/app/sdk_main.go +62 -0
- package/dist/templates/native-go/backend/cmd/background-worker/main.go +38 -0
- package/dist/templates/native-go/backend/cmd/helper/main.go +27 -1
- package/dist/templates/native-go/backend/cmd/helper/sdk_registry.go +19 -0
- package/dist/templates/native-go/backend/go.mod +5 -3
- package/dist/templates/native-go/backend/go.sum +4 -4
- package/dist/templates/native-go/backend/internal/api/registry.go +17 -6
- package/dist/templates/native-go/backend/internal/api/server.go +7 -1
- package/dist/templates/native-go/backend/internal/app/authorization_none.go +5 -0
- package/dist/templates/native-go/backend/internal/app/background.go +270 -0
- package/dist/templates/native-go/backend/internal/app/background_none.go +8 -0
- package/dist/templates/native-go/backend/internal/app/background_owner.go +59 -0
- package/dist/templates/native-go/backend/internal/app/background_owner_test.go +145 -0
- package/dist/templates/native-go/backend/internal/app/background_schedule.go +74 -0
- package/dist/templates/native-go/backend/internal/app/background_schedule_test.go +62 -0
- package/dist/templates/native-go/backend/internal/app/background_test.go +346 -0
- package/dist/templates/native-go/backend/internal/app/integration_state.go +16 -0
- package/dist/templates/native-go/backend/internal/app/migrations.go +41 -0
- package/dist/templates/native-go/backend/internal/app/migrations_test.go +41 -0
- package/dist/templates/native-go/backend/internal/app/nas_cgi_artifact_test.go +8 -0
- package/dist/templates/native-go/backend/internal/app/routes.go +22 -5
- package/dist/templates/native-go/backend/internal/app/routes_test.go +20 -3
- package/dist/templates/native-go/backend/internal/app/sdk_jobs.go +70 -0
- package/dist/templates/native-go/backend/internal/app/sdk_jobs_test.go +116 -0
- package/dist/templates/native-go/backend/internal/app/sdk_routes.go +177 -0
- package/dist/templates/native-go/backend/internal/app/session_files.go +15 -0
- package/dist/templates/native-go/backend/internal/app/session_files_test.go +26 -0
- package/dist/templates/native-go/backend/internal/app/shared_folder.go +144 -0
- package/dist/templates/native-go/backend/internal/app/shared_folder_test.go +158 -0
- package/dist/templates/native-go/backend/internal/background/access.go +57 -0
- package/dist/templates/native-go/backend/internal/background/owner_test.go +126 -0
- package/dist/templates/native-go/backend/internal/background/runner.go +185 -0
- package/dist/templates/native-go/backend/internal/background/runner_test.go +209 -0
- package/dist/templates/native-go/backend/internal/background/schedule.go +300 -0
- package/dist/templates/native-go/backend/internal/background/schedule_test.go +335 -0
- package/dist/templates/native-go/backend/internal/background/store.go +807 -0
- package/dist/templates/native-go/backend/internal/background/store_test.go +407 -0
- package/dist/templates/native-go/backend/internal/datamigrate/migrate.go +191 -0
- package/dist/templates/native-go/backend/internal/datamigrate/migrate_test.go +177 -0
- package/dist/templates/native-go/backend/internal/filestation/browse_test.go +67 -0
- package/dist/templates/native-go/backend/internal/filestation/client.go +251 -0
- package/dist/templates/native-go/backend/internal/filestation/client_test.go +155 -0
- package/dist/templates/native-go/backend/internal/filestation/doc.go +4 -0
- package/dist/templates/native-go/backend/internal/filestation/read_file_test.go +90 -0
- package/dist/templates/native-go/backend/internal/filestation/repository.go +207 -0
- package/dist/templates/native-go/backend/internal/filestation/repository_test.go +104 -0
- package/dist/templates/native-go/backend/internal/filestation/sdk_session.go +241 -0
- package/dist/templates/native-go/backend/internal/filestation/sdk_session_test.go +183 -0
- package/dist/templates/native-go/backend/internal/filestation/service.go +254 -0
- package/dist/templates/native-go/backend/internal/filestation/service_test.go +94 -0
- package/dist/templates/native-go/backend/internal/filestation/session_semantics_test.go +383 -0
- package/dist/templates/native-go/backend/internal/filestation/write.go +72 -0
- package/dist/templates/native-go/backend/internal/filestation/write_test.go +123 -0
- package/dist/templates/native-go/backend/internal/helper/background_proof.go +163 -0
- package/dist/templates/native-go/backend/internal/helper/background_proof_contract.go +46 -0
- package/dist/templates/native-go/backend/internal/helper/background_proof_test.go +161 -0
- package/dist/templates/native-go/backend/internal/helper/data_contract.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/data_protocol.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/data_protocol_test.go +1 -1
- package/dist/templates/native-go/backend/internal/helper/grant_authority.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/grant_authority_test.go +1 -1
- package/dist/templates/native-go/backend/internal/helper/grant_repository_linux.go +2 -1
- package/dist/templates/native-go/backend/internal/helper/grant_repository_linux_test.go +4 -3
- package/dist/templates/native-go/backend/internal/helper/grant_snapshot.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/bindings.go +48 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/contract_test.go +436 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/decode.go +185 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/digest.go +55 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/registry.go +85 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/registry_test.go +73 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/result.go +53 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/stub.go +8 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/testdata/input-digests.json +127 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/types.go +234 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/types_test.go +29 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/validate.go +462 -0
- package/dist/templates/native-go/backend/internal/helper/legacy_authority_schema_linux_test.go +34 -0
- package/dist/templates/native-go/backend/internal/helper/legacy_authority_schema_test.go +6 -0
- package/dist/templates/native-go/backend/internal/helper/management.go +86 -0
- package/dist/templates/native-go/backend/internal/helper/observation.go +42 -2
- package/dist/templates/native-go/backend/internal/helper/observation_health_test.go +13 -1
- package/dist/templates/native-go/backend/internal/helper/observer_diagnostic.go +56 -10
- package/dist/templates/native-go/backend/internal/helper/observer_diagnostic_linux_test.go +6 -0
- package/dist/templates/native-go/backend/internal/helper/observer_diagnostic_writer.go +40 -0
- package/dist/templates/native-go/backend/internal/helper/process_linux.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/purge.go +115 -0
- package/dist/templates/native-go/backend/internal/helper/purge_test.go +59 -0
- package/dist/templates/native-go/backend/internal/helper/query_deadline_linux_test.go +115 -0
- package/dist/templates/native-go/backend/internal/helper/query_pending_diagnostic_test.go +254 -0
- package/dist/templates/native-go/backend/internal/helper/relaxed_invalidation.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/revoke.go +109 -0
- package/dist/templates/native-go/backend/internal/helper/revoke_test.go +121 -0
- package/dist/templates/native-go/backend/internal/helper/s1r_actor_races_linux_test.go +23 -4
- package/dist/templates/native-go/backend/internal/helper/sdk_assembly_linux.go +51 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_attach.go +83 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_attach_contract.go +32 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_attach_test.go +184 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_authority_schema_test.go +6 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_authority.go +832 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_authority_test.go +714 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_invalidation.go +218 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_lease.go +218 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_snapshot.go +110 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_store_linux_test.go +261 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_store_test.go +58 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_bindings.go +60 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_data_contract.go +251 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_data_protocol.go +424 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_dispatch_absence_test.go +51 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_display.go +488 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_display_contract.go +121 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_display_test.go +459 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_grant_authority.go +559 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_grant_repository_linux.go +417 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_grant_snapshot.go +94 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_history.go +80 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_history_test.go +76 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job.go +697 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job_child_linux.go +309 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job_contract.go +122 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job_linux_test.go +159 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job_process_linux.go +327 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job_test.go +501 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job_vm_linux_test.go +343 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_journal.go +77 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_journal_linux.go +244 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_journal_linux_test.go +295 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_journal_test.go +71 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_picker_test.go +50 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_process_linux.go +184 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_public_vm_linux_test.go +129 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_relaxed_invalidation.go +242 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_rpc.go +299 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_rpc_contract.go +70 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_rpc_test.go +135 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_server_linux.go +161 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_session.go +677 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_session_contract.go +72 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_session_fence_test.go +215 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_session_test.go +475 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_supervisor_frame.go +78 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_supervisor_linux.go +414 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_transport.go +79 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_transport_linux.go +82 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_transport_test.go +64 -0
- package/dist/templates/native-go/backend/internal/helper/server_linux.go +14 -2
- package/dist/templates/native-go/backend/internal/helper/stale_management_linux_test.go +126 -0
- package/dist/templates/native-go/backend/internal/helper/stale_management_test.go +122 -0
- package/dist/templates/native-go/backend/internal/helper/startup_diagnostic.go +68 -0
- package/dist/templates/native-go/backend/internal/helper/startup_diagnostic_linux_test.go +126 -0
- package/dist/templates/native-go/backend/internal/helper/startup_diagnostic_test.go +117 -0
- package/dist/templates/native-go/backend/internal/helper/status.go +22 -13
- package/dist/templates/native-go/backend/internal/helper/status_test.go +45 -0
- package/dist/templates/native-go/backend/internal/helper/supervision.go +1 -1
- package/dist/templates/native-go/backend/internal/helper/supervisor_frame.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/supervisor_linux.go +6 -2
- package/dist/templates/native-go/backend/internal/helper/unit_connection_test.go +22 -4
- package/dist/templates/native-go/backend/internal/helper/unit_linux.go +7 -3
- package/dist/templates/native-go/backend/internal/helper/unit_query_linux.go +5 -1
- package/dist/templates/native-go/backend/internal/helper/write_files_linux.go +7 -4
- package/dist/templates/native-go/backend/internal/helper/write_files_linux_test.go +26 -0
- package/dist/templates/native-go/dsm-package.yaml +2 -2
- package/dist/templates/native-go-authorization/backend/internal/app/authorization.go +298 -0
- package/dist/templates/native-go-authorization/backend/internal/app/authorization_test.go +96 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/AuthorizationGate.vue +89 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/de.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/en.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/es.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/fr.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/index.ts +15 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/it.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/ja.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/ko.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/zh-CN.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/zh-TW.json +36 -0
- package/dist/templates/native-go-authorization/frontend/test/authorization-preview.html +14 -0
- package/dist/templates/native-go-authorization/frontend/test/authorization.test.ts +59 -0
- package/dist/templates/native-go-background/BACKGROUND.md +111 -0
- package/dist/templates/native-go-background/backend/internal/app/background_on.go +7 -0
- package/dist/templates/native-go-background/backend/internal/app/background_routes_test.go +32 -0
- package/dist/templates/native-go-background/frontend/src/background/BackgroundPanel.vue +178 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/de.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/en.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/es.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/fr.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/it.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/ja.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/ko.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/zh-CN.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/zh-TW.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n.ts +19 -0
- package/dist/templates/native-go-background/frontend/src/background/picker-provider.ts +13 -0
- package/dist/templates/native-go-background/frontend/test/background.test.ts +179 -0
- package/dist/templates/native-go-integration/backend/internal/app/personal.go +2 -2
- package/dist/templates/native-go-integration/backend/internal/app/personal_test.go +37 -0
- package/dist/templates/native-go-vue/README.md +38 -7
- package/dist/templates/native-go-vue/frontend/DESIGN.md +15 -3
- package/dist/templates/native-go-vue/frontend/README-JOBS.md +75 -0
- package/dist/templates/native-go-vue/frontend/README-M2.md +64 -0
- package/dist/templates/native-go-vue/frontend/package-lock.json +5 -4
- package/dist/templates/native-go-vue/frontend/package.json +1 -1
- package/dist/templates/native-go-vue/frontend/src/App.vue +39 -11
- package/dist/templates/native-go-vue/frontend/src/M2App.vue +57 -0
- package/dist/templates/native-go-vue/frontend/src/SDKApp.vue +203 -0
- package/dist/templates/native-go-vue/frontend/src/context.ts +3 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/InteractiveJobForm.vue +70 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/JobsAdminPanel.vue +33 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/JobsPanel.vue +135 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/connected-provider.ts +179 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/de.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/en.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/es.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/fr.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/it.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/ja.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/ko.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/zh-CN.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/zh-TW.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n.ts +15 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/mock-provider.ts +67 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/provider.ts +60 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/validate.ts +44 -0
- package/dist/templates/native-go-vue/frontend/src/m2-main.ts +21 -0
- package/dist/templates/native-go-vue/frontend/src/m2-style.css +7 -0
- package/dist/templates/native-go-vue/frontend/src/nas/M2Files.vue +94 -0
- package/dist/templates/native-go-vue/frontend/src/nas/M2PathPicker.vue +70 -0
- package/dist/templates/native-go-vue/frontend/src/nas/M2Settings.vue +69 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/de.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/en.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/es.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/fr.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/it.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/ja.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/ko.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/zh-CN.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/zh-TW.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/m2-contract.ts +33 -0
- package/dist/templates/native-go-vue/frontend/src/nas/m2-i18n.ts +24 -0
- package/dist/templates/native-go-vue/frontend/src/nas/m2-provider.ts +104 -0
- package/dist/templates/native-go-vue/frontend/src/nas/use-m2-request.ts +18 -0
- package/dist/templates/native-go-vue/frontend/src/sdk-main.ts +39 -0
- package/dist/templates/native-go-vue/frontend/src/shell/AppShell.vue +48 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/de.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/en.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/es.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/fr.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/it.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/ja.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/ko.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/zh-CN.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/zh-TW.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n.ts +17 -0
- package/dist/templates/native-go-vue/frontend/src/shell/pages.ts +34 -0
- package/dist/templates/native-go-vue/frontend/src/style.css +2 -6
- package/dist/templates/native-go-vue/frontend/test/apps.test.ts +21 -0
- package/dist/templates/native-go-vue/frontend/test/jobs-connected.test.ts +163 -0
- package/dist/templates/native-go-vue/frontend/test/jobs-preview.html +22 -0
- package/dist/templates/native-go-vue/frontend/test/jobs.test.ts +176 -0
- package/dist/templates/native-go-vue/frontend/test/m2-preview.html +27 -0
- package/dist/templates/native-go-vue/frontend/test/m2-provider.test.ts +87 -0
- package/dist/templates/native-go-vue/frontend/test/m2-ui.test.ts +209 -0
- package/dist/templates/native-go-vue/frontend/test/native-controls.test.ts +27 -0
- package/dist/templates/native-go-vue/frontend/test/picker-wire.test.ts +110 -0
- package/dist/templates/native-go-vue/frontend/test/shell-preview.html +19 -0
- package/dist/templates/native-go-vue/frontend/test/shell-sdk.test.ts +73 -0
- package/dist/templates/native-go-vue/frontend/test/shell-ui.test.ts +114 -0
- package/dist/templates/native-go-vue/frontend/test/shell.test.ts +45 -0
- package/dist/templates/native-go-vue/frontend/vite.config.ts +2 -2
- package/dist/types.d.ts +1 -1
- package/dist/validate.js +6 -3
- package/package.json +5 -2
- package/schema/synology-app.schema.json +19 -0
- package/skills/reference/create.md +6 -2
- package/templates/_authorization/main.go +104 -0
- package/templates/_authorization/main_test.go +35 -0
- package/templates/_daemon/go.mod +2 -0
- package/templates/_gateway/auth.go +101 -0
- package/templates/_gateway/auth_test.go +216 -0
- package/templates/_gateway/cgi.go +133 -0
- package/templates/_gateway/cgi_test.go +156 -0
- package/templates/_gateway/csrf.go +73 -0
- package/templates/_gateway/csrf_test.go +155 -0
- package/templates/_gateway/directory.go +108 -0
- package/templates/_gateway/directory_test.go +202 -0
- package/templates/_gateway/gateway.go +412 -0
- package/templates/_gateway/gateway_test.go +676 -0
- package/templates/_gateway/go.mod +3 -0
- package/templates/_gateway/groups.go +66 -0
- package/templates/_gateway/main.go +45 -0
- package/templates/binary/synology-app.yaml +1 -1
- package/templates/compose-import/compose.yaml +1 -1
- package/templates/compose-import/synology-app.yaml +1 -1
- package/templates/hello-files/compose.yaml +1 -1
- package/templates/hello-files/synology-app.yaml +1 -1
- package/templates/native-go/README.md +118 -5
- package/templates/native-go/backend/THIRD_PARTY_NOTICES.txt +3 -1
- package/templates/native-go/backend/cmd/app/main.go +25 -6
- package/templates/native-go/backend/cmd/app/sdk_main.go +62 -0
- package/templates/native-go/backend/cmd/background-worker/main.go +38 -0
- package/templates/native-go/backend/cmd/helper/main.go +27 -1
- package/templates/native-go/backend/cmd/helper/sdk_registry.go +19 -0
- package/templates/native-go/backend/go.mod +5 -3
- package/templates/native-go/backend/go.sum +4 -4
- package/templates/native-go/backend/internal/api/registry.go +17 -6
- package/templates/native-go/backend/internal/api/server.go +7 -1
- package/templates/native-go/backend/internal/app/authorization_none.go +5 -0
- package/templates/native-go/backend/internal/app/background.go +270 -0
- package/templates/native-go/backend/internal/app/background_none.go +8 -0
- package/templates/native-go/backend/internal/app/background_owner.go +59 -0
- package/templates/native-go/backend/internal/app/background_owner_test.go +145 -0
- package/templates/native-go/backend/internal/app/background_schedule.go +74 -0
- package/templates/native-go/backend/internal/app/background_schedule_test.go +62 -0
- package/templates/native-go/backend/internal/app/background_test.go +346 -0
- package/templates/native-go/backend/internal/app/integration_state.go +16 -0
- package/templates/native-go/backend/internal/app/migrations.go +41 -0
- package/templates/native-go/backend/internal/app/migrations_test.go +41 -0
- package/templates/native-go/backend/internal/app/nas_cgi_artifact_test.go +8 -0
- package/templates/native-go/backend/internal/app/routes.go +22 -5
- package/templates/native-go/backend/internal/app/routes_test.go +20 -3
- package/templates/native-go/backend/internal/app/sdk_jobs.go +70 -0
- package/templates/native-go/backend/internal/app/sdk_jobs_test.go +116 -0
- package/templates/native-go/backend/internal/app/sdk_routes.go +177 -0
- package/templates/native-go/backend/internal/app/session_files.go +15 -0
- package/templates/native-go/backend/internal/app/session_files_test.go +26 -0
- package/templates/native-go/backend/internal/app/shared_folder.go +144 -0
- package/templates/native-go/backend/internal/app/shared_folder_test.go +158 -0
- package/templates/native-go/backend/internal/background/access.go +57 -0
- package/templates/native-go/backend/internal/background/owner_test.go +126 -0
- package/templates/native-go/backend/internal/background/runner.go +185 -0
- package/templates/native-go/backend/internal/background/runner_test.go +209 -0
- package/templates/native-go/backend/internal/background/schedule.go +300 -0
- package/templates/native-go/backend/internal/background/schedule_test.go +335 -0
- package/templates/native-go/backend/internal/background/store.go +807 -0
- package/templates/native-go/backend/internal/background/store_test.go +407 -0
- package/templates/native-go/backend/internal/datamigrate/migrate.go +191 -0
- package/templates/native-go/backend/internal/datamigrate/migrate_test.go +177 -0
- package/templates/native-go/backend/internal/filestation/browse_test.go +67 -0
- package/templates/native-go/backend/internal/filestation/client.go +251 -0
- package/templates/native-go/backend/internal/filestation/client_test.go +155 -0
- package/templates/native-go/backend/internal/filestation/doc.go +4 -0
- package/templates/native-go/backend/internal/filestation/read_file_test.go +90 -0
- package/templates/native-go/backend/internal/filestation/repository.go +207 -0
- package/templates/native-go/backend/internal/filestation/repository_test.go +104 -0
- package/templates/native-go/backend/internal/filestation/sdk_session.go +241 -0
- package/templates/native-go/backend/internal/filestation/sdk_session_test.go +183 -0
- package/templates/native-go/backend/internal/filestation/service.go +254 -0
- package/templates/native-go/backend/internal/filestation/service_test.go +94 -0
- package/templates/native-go/backend/internal/filestation/session_semantics_test.go +383 -0
- package/templates/native-go/backend/internal/filestation/write.go +72 -0
- package/templates/native-go/backend/internal/filestation/write_test.go +123 -0
- package/templates/native-go/backend/internal/helper/background_proof.go +163 -0
- package/templates/native-go/backend/internal/helper/background_proof_contract.go +46 -0
- package/templates/native-go/backend/internal/helper/background_proof_test.go +161 -0
- package/templates/native-go/backend/internal/helper/data_contract.go +3 -0
- package/templates/native-go/backend/internal/helper/data_protocol.go +3 -0
- package/templates/native-go/backend/internal/helper/data_protocol_test.go +1 -1
- package/templates/native-go/backend/internal/helper/grant_authority.go +3 -0
- package/templates/native-go/backend/internal/helper/grant_authority_test.go +1 -1
- package/templates/native-go/backend/internal/helper/grant_repository_linux.go +2 -1
- package/templates/native-go/backend/internal/helper/grant_repository_linux_test.go +4 -3
- package/templates/native-go/backend/internal/helper/grant_snapshot.go +3 -0
- package/templates/native-go/backend/internal/helper/jobcontract/bindings.go +48 -0
- package/templates/native-go/backend/internal/helper/jobcontract/contract_test.go +436 -0
- package/templates/native-go/backend/internal/helper/jobcontract/decode.go +185 -0
- package/templates/native-go/backend/internal/helper/jobcontract/digest.go +55 -0
- package/templates/native-go/backend/internal/helper/jobcontract/registry.go +85 -0
- package/templates/native-go/backend/internal/helper/jobcontract/registry_test.go +73 -0
- package/templates/native-go/backend/internal/helper/jobcontract/result.go +53 -0
- package/templates/native-go/backend/internal/helper/jobcontract/stub.go +8 -0
- package/templates/native-go/backend/internal/helper/jobcontract/testdata/input-digests.json +127 -0
- package/templates/native-go/backend/internal/helper/jobcontract/types.go +234 -0
- package/templates/native-go/backend/internal/helper/jobcontract/types_test.go +29 -0
- package/templates/native-go/backend/internal/helper/jobcontract/validate.go +462 -0
- package/templates/native-go/backend/internal/helper/legacy_authority_schema_linux_test.go +34 -0
- package/templates/native-go/backend/internal/helper/legacy_authority_schema_test.go +6 -0
- package/templates/native-go/backend/internal/helper/management.go +86 -0
- package/templates/native-go/backend/internal/helper/observation.go +42 -2
- package/templates/native-go/backend/internal/helper/observation_health_test.go +13 -1
- package/templates/native-go/backend/internal/helper/observer_diagnostic.go +56 -10
- package/templates/native-go/backend/internal/helper/observer_diagnostic_linux_test.go +6 -0
- package/templates/native-go/backend/internal/helper/observer_diagnostic_writer.go +40 -0
- package/templates/native-go/backend/internal/helper/process_linux.go +3 -0
- package/templates/native-go/backend/internal/helper/purge.go +115 -0
- package/templates/native-go/backend/internal/helper/purge_test.go +59 -0
- package/templates/native-go/backend/internal/helper/query_deadline_linux_test.go +115 -0
- package/templates/native-go/backend/internal/helper/query_pending_diagnostic_test.go +254 -0
- package/templates/native-go/backend/internal/helper/relaxed_invalidation.go +3 -0
- package/templates/native-go/backend/internal/helper/revoke.go +109 -0
- package/templates/native-go/backend/internal/helper/revoke_test.go +121 -0
- package/templates/native-go/backend/internal/helper/s1r_actor_races_linux_test.go +23 -4
- package/templates/native-go/backend/internal/helper/sdk_assembly_linux.go +51 -0
- package/templates/native-go/backend/internal/helper/sdk_attach.go +83 -0
- package/templates/native-go/backend/internal/helper/sdk_attach_contract.go +32 -0
- package/templates/native-go/backend/internal/helper/sdk_attach_test.go +184 -0
- package/templates/native-go/backend/internal/helper/sdk_authority_schema_test.go +6 -0
- package/templates/native-go/backend/internal/helper/sdk_background_authority.go +832 -0
- package/templates/native-go/backend/internal/helper/sdk_background_authority_test.go +714 -0
- package/templates/native-go/backend/internal/helper/sdk_background_invalidation.go +218 -0
- package/templates/native-go/backend/internal/helper/sdk_background_lease.go +218 -0
- package/templates/native-go/backend/internal/helper/sdk_background_snapshot.go +110 -0
- package/templates/native-go/backend/internal/helper/sdk_background_store_linux_test.go +261 -0
- package/templates/native-go/backend/internal/helper/sdk_background_store_test.go +58 -0
- package/templates/native-go/backend/internal/helper/sdk_bindings.go +60 -0
- package/templates/native-go/backend/internal/helper/sdk_data_contract.go +251 -0
- package/templates/native-go/backend/internal/helper/sdk_data_protocol.go +424 -0
- package/templates/native-go/backend/internal/helper/sdk_dispatch_absence_test.go +51 -0
- package/templates/native-go/backend/internal/helper/sdk_display.go +488 -0
- package/templates/native-go/backend/internal/helper/sdk_display_contract.go +121 -0
- package/templates/native-go/backend/internal/helper/sdk_display_test.go +459 -0
- package/templates/native-go/backend/internal/helper/sdk_grant_authority.go +559 -0
- package/templates/native-go/backend/internal/helper/sdk_grant_repository_linux.go +417 -0
- package/templates/native-go/backend/internal/helper/sdk_grant_snapshot.go +94 -0
- package/templates/native-go/backend/internal/helper/sdk_history.go +80 -0
- package/templates/native-go/backend/internal/helper/sdk_history_test.go +76 -0
- package/templates/native-go/backend/internal/helper/sdk_job.go +697 -0
- package/templates/native-go/backend/internal/helper/sdk_job_child_linux.go +309 -0
- package/templates/native-go/backend/internal/helper/sdk_job_contract.go +122 -0
- package/templates/native-go/backend/internal/helper/sdk_job_linux_test.go +159 -0
- package/templates/native-go/backend/internal/helper/sdk_job_process_linux.go +327 -0
- package/templates/native-go/backend/internal/helper/sdk_job_test.go +501 -0
- package/templates/native-go/backend/internal/helper/sdk_job_vm_linux_test.go +343 -0
- package/templates/native-go/backend/internal/helper/sdk_journal.go +77 -0
- package/templates/native-go/backend/internal/helper/sdk_journal_linux.go +244 -0
- package/templates/native-go/backend/internal/helper/sdk_journal_linux_test.go +295 -0
- package/templates/native-go/backend/internal/helper/sdk_journal_test.go +71 -0
- package/templates/native-go/backend/internal/helper/sdk_picker_test.go +50 -0
- package/templates/native-go/backend/internal/helper/sdk_process_linux.go +184 -0
- package/templates/native-go/backend/internal/helper/sdk_public_vm_linux_test.go +129 -0
- package/templates/native-go/backend/internal/helper/sdk_relaxed_invalidation.go +242 -0
- package/templates/native-go/backend/internal/helper/sdk_rpc.go +299 -0
- package/templates/native-go/backend/internal/helper/sdk_rpc_contract.go +70 -0
- package/templates/native-go/backend/internal/helper/sdk_rpc_test.go +135 -0
- package/templates/native-go/backend/internal/helper/sdk_server_linux.go +161 -0
- package/templates/native-go/backend/internal/helper/sdk_session.go +677 -0
- package/templates/native-go/backend/internal/helper/sdk_session_contract.go +72 -0
- package/templates/native-go/backend/internal/helper/sdk_session_fence_test.go +215 -0
- package/templates/native-go/backend/internal/helper/sdk_session_test.go +475 -0
- package/templates/native-go/backend/internal/helper/sdk_supervisor_frame.go +78 -0
- package/templates/native-go/backend/internal/helper/sdk_supervisor_linux.go +414 -0
- package/templates/native-go/backend/internal/helper/sdk_transport.go +79 -0
- package/templates/native-go/backend/internal/helper/sdk_transport_linux.go +82 -0
- package/templates/native-go/backend/internal/helper/sdk_transport_test.go +64 -0
- package/templates/native-go/backend/internal/helper/server_linux.go +14 -2
- package/templates/native-go/backend/internal/helper/stale_management_linux_test.go +126 -0
- package/templates/native-go/backend/internal/helper/stale_management_test.go +122 -0
- package/templates/native-go/backend/internal/helper/startup_diagnostic.go +68 -0
- package/templates/native-go/backend/internal/helper/startup_diagnostic_linux_test.go +126 -0
- package/templates/native-go/backend/internal/helper/startup_diagnostic_test.go +117 -0
- package/templates/native-go/backend/internal/helper/status.go +22 -13
- package/templates/native-go/backend/internal/helper/status_test.go +45 -0
- package/templates/native-go/backend/internal/helper/supervision.go +1 -1
- package/templates/native-go/backend/internal/helper/supervisor_frame.go +3 -0
- package/templates/native-go/backend/internal/helper/supervisor_linux.go +6 -2
- package/templates/native-go/backend/internal/helper/unit_connection_test.go +22 -4
- package/templates/native-go/backend/internal/helper/unit_linux.go +7 -3
- package/templates/native-go/backend/internal/helper/unit_query_linux.go +5 -1
- package/templates/native-go/backend/internal/helper/write_files_linux.go +7 -4
- package/templates/native-go/backend/internal/helper/write_files_linux_test.go +26 -0
- package/templates/native-go/dsm-package.yaml +2 -2
- package/templates/native-go-authorization/backend/internal/app/authorization.go +298 -0
- package/templates/native-go-authorization/backend/internal/app/authorization_test.go +96 -0
- package/templates/native-go-authorization/frontend/src/authorization/AuthorizationGate.vue +89 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/de.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/en.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/es.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/fr.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/index.ts +15 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/it.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/ja.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/ko.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/zh-CN.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/zh-TW.json +36 -0
- package/templates/native-go-authorization/frontend/test/authorization-preview.html +14 -0
- package/templates/native-go-authorization/frontend/test/authorization.test.ts +59 -0
- package/templates/native-go-background/BACKGROUND.md +111 -0
- package/templates/native-go-background/backend/internal/app/background_on.go +7 -0
- package/templates/native-go-background/backend/internal/app/background_routes_test.go +32 -0
- package/templates/native-go-background/frontend/src/background/BackgroundPanel.vue +178 -0
- package/templates/native-go-background/frontend/src/background/i18n/de.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/en.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/es.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/fr.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/it.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/ja.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/ko.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/zh-CN.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/zh-TW.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n.ts +19 -0
- package/templates/native-go-background/frontend/src/background/picker-provider.ts +13 -0
- package/templates/native-go-background/frontend/test/background.test.ts +179 -0
- package/templates/native-go-integration/backend/internal/app/personal.go +2 -2
- package/templates/native-go-integration/backend/internal/app/personal_test.go +37 -0
- package/templates/native-go-vue/README.md +38 -7
- package/templates/native-go-vue/frontend/DESIGN.md +15 -3
- package/templates/native-go-vue/frontend/README-JOBS.md +75 -0
- package/templates/native-go-vue/frontend/README-M2.md +64 -0
- package/templates/native-go-vue/frontend/package-lock.json +5 -4
- package/templates/native-go-vue/frontend/package.json +1 -1
- package/templates/native-go-vue/frontend/src/App.vue +39 -11
- package/templates/native-go-vue/frontend/src/M2App.vue +57 -0
- package/templates/native-go-vue/frontend/src/SDKApp.vue +203 -0
- package/templates/native-go-vue/frontend/src/context.ts +3 -0
- package/templates/native-go-vue/frontend/src/jobs/InteractiveJobForm.vue +70 -0
- package/templates/native-go-vue/frontend/src/jobs/JobsAdminPanel.vue +33 -0
- package/templates/native-go-vue/frontend/src/jobs/JobsPanel.vue +135 -0
- package/templates/native-go-vue/frontend/src/jobs/connected-provider.ts +179 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/de.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/en.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/es.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/fr.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/it.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/ja.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/ko.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/zh-CN.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/zh-TW.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n.ts +15 -0
- package/templates/native-go-vue/frontend/src/jobs/mock-provider.ts +67 -0
- package/templates/native-go-vue/frontend/src/jobs/provider.ts +60 -0
- package/templates/native-go-vue/frontend/src/jobs/validate.ts +44 -0
- package/templates/native-go-vue/frontend/src/m2-main.ts +21 -0
- package/templates/native-go-vue/frontend/src/m2-style.css +7 -0
- package/templates/native-go-vue/frontend/src/nas/M2Files.vue +94 -0
- package/templates/native-go-vue/frontend/src/nas/M2PathPicker.vue +70 -0
- package/templates/native-go-vue/frontend/src/nas/M2Settings.vue +69 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/de.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/en.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/es.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/fr.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/it.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/ja.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/ko.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/zh-CN.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/zh-TW.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/m2-contract.ts +33 -0
- package/templates/native-go-vue/frontend/src/nas/m2-i18n.ts +24 -0
- package/templates/native-go-vue/frontend/src/nas/m2-provider.ts +104 -0
- package/templates/native-go-vue/frontend/src/nas/use-m2-request.ts +18 -0
- package/templates/native-go-vue/frontend/src/sdk-main.ts +39 -0
- package/templates/native-go-vue/frontend/src/shell/AppShell.vue +48 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/de.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/en.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/es.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/fr.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/it.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/ja.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/ko.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/zh-CN.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/zh-TW.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n.ts +17 -0
- package/templates/native-go-vue/frontend/src/shell/pages.ts +34 -0
- package/templates/native-go-vue/frontend/src/style.css +2 -6
- package/templates/native-go-vue/frontend/test/apps.test.ts +21 -0
- package/templates/native-go-vue/frontend/test/jobs-connected.test.ts +163 -0
- package/templates/native-go-vue/frontend/test/jobs-preview.html +22 -0
- package/templates/native-go-vue/frontend/test/jobs.test.ts +176 -0
- package/templates/native-go-vue/frontend/test/m2-preview.html +27 -0
- package/templates/native-go-vue/frontend/test/m2-provider.test.ts +87 -0
- package/templates/native-go-vue/frontend/test/m2-ui.test.ts +209 -0
- package/templates/native-go-vue/frontend/test/native-controls.test.ts +27 -0
- package/templates/native-go-vue/frontend/test/picker-wire.test.ts +110 -0
- package/templates/native-go-vue/frontend/test/shell-preview.html +19 -0
- package/templates/native-go-vue/frontend/test/shell-sdk.test.ts +73 -0
- package/templates/native-go-vue/frontend/test/shell-ui.test.ts +114 -0
- package/templates/native-go-vue/frontend/test/shell.test.ts +45 -0
- package/templates/native-go-vue/frontend/vite.config.ts +2 -2
- package/dist/templates/hello-web/compose.yaml +0 -21
- package/dist/templates/hello-web/html/app.js +0 -1
- package/dist/templates/hello-web/html/index.html +0 -13
- package/dist/templates/hello-web/synology-app.yaml +0 -13
- package/dist/templates/hello-web-page/compose.yaml +0 -21
- package/dist/templates/hello-web-page/html/app.js +0 -1
- package/dist/templates/hello-web-page/html/index.html +0 -13
- package/dist/templates/hello-web-page/synology-app.yaml +0 -13
- package/templates/hello-web/compose.yaml +0 -21
- package/templates/hello-web/html/app.js +0 -1
- package/templates/hello-web/html/index.html +0 -13
- package/templates/hello-web/synology-app.yaml +0 -13
- package/templates/hello-web-page/compose.yaml +0 -21
- package/templates/hello-web-page/html/app.js +0 -1
- package/templates/hello-web-page/html/index.html +0 -13
- package/templates/hello-web-page/synology-app.yaml +0 -13
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
package helper
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"encoding/json"
|
|
5
|
+
"os"
|
|
6
|
+
"path/filepath"
|
|
7
|
+
"strings"
|
|
8
|
+
"sync/atomic"
|
|
9
|
+
"testing"
|
|
10
|
+
"time"
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
func TestQueryPendingDiagnosticSnapshotIsBoundedAndDetached(t *testing.T) {
|
|
14
|
+
g := newAdmission(testBinding())
|
|
15
|
+
now := time.Now().In(time.FixedZone("fixture", 8*60*60))
|
|
16
|
+
g.queryPending = &observerQueryPending{StartedAt: now, PendingAt: now.Add(500 * time.Millisecond), Outcome: "pending", Phase: "get-unit", ErrorClass: "deadline"}
|
|
17
|
+
for n := 0; n < observerEventLimit+20; n++ {
|
|
18
|
+
g.recordObserver(observerEvent{Kind: "query-phase"})
|
|
19
|
+
}
|
|
20
|
+
d := g.observerDiagnostic(strings.Repeat("e", 64))
|
|
21
|
+
if d.QueryPending == nil || !d.QueryPending.StartedAt.Equal(now) {
|
|
22
|
+
t.Fatalf("missing pinned period: %+v", d)
|
|
23
|
+
}
|
|
24
|
+
if d.QueryPending.StartedAt.Location() != time.UTC || d.QueryPending.PendingAt.Location() != time.UTC {
|
|
25
|
+
t.Fatal("diagnostic timestamps are not UTC")
|
|
26
|
+
}
|
|
27
|
+
d.QueryPending.Outcome = "mutated"
|
|
28
|
+
if g.observerDiagnostic(d.Epoch).QueryPending.Outcome != "pending" {
|
|
29
|
+
t.Fatal("snapshot aliases period")
|
|
30
|
+
}
|
|
31
|
+
payload, err := json.Marshal(d)
|
|
32
|
+
if err != nil || len(payload) > observerDiagnosticLimit {
|
|
33
|
+
t.Fatalf("size %d: %v", len(payload), err)
|
|
34
|
+
}
|
|
35
|
+
var decoded observerDiagnostic
|
|
36
|
+
if err := json.Unmarshal(payload, &decoded); err != nil || decoded.QueryPending == nil || !decoded.QueryPending.StartedAt.Equal(now) {
|
|
37
|
+
t.Fatalf("period roundtrip: %+v %v", decoded, err)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
func TestQueryPendingDiagnosticPeriodLifecycle(t *testing.T) {
|
|
42
|
+
for _, outcome := range []string{"ready", "fence", "signal-fence", "reload-fence"} {
|
|
43
|
+
t.Run(outcome, func(t *testing.T) {
|
|
44
|
+
start := time.Now()
|
|
45
|
+
g := newAdmission(testBinding())
|
|
46
|
+
g.observeUnit(testBinding(), 7, "", false, true, 0, start)
|
|
47
|
+
e := observerEvent{Phase: "get-owner", ErrorClass: "deadline", QuerySerial: 0}
|
|
48
|
+
if !g.deferUnitDeadline(0, start, start.Add(500*time.Millisecond), e) {
|
|
49
|
+
t.Fatal("first timeout fenced")
|
|
50
|
+
}
|
|
51
|
+
first := g.observerDiagnostic("").QueryPending
|
|
52
|
+
if first == nil || !first.StartedAt.Equal(start) || !first.PendingAt.Equal(start.Add(500*time.Millisecond)) || first.Outcome != "pending" || first.Phase != "get-owner" || first.ElapsedNS != 0 {
|
|
53
|
+
t.Fatalf("wrong first query: %+v", first)
|
|
54
|
+
}
|
|
55
|
+
e.Phase = "get-all"
|
|
56
|
+
if !g.deferUnitDeadline(0, start.Add(750*time.Millisecond), start.Add(time.Second), e) {
|
|
57
|
+
t.Fatal("retry fenced")
|
|
58
|
+
}
|
|
59
|
+
for n := 0; n < observerEventLimit+20; n++ {
|
|
60
|
+
g.recordObserver(observerEvent{Kind: "query-phase"})
|
|
61
|
+
}
|
|
62
|
+
end := start.Add(1500 * time.Millisecond)
|
|
63
|
+
want := outcome
|
|
64
|
+
switch outcome {
|
|
65
|
+
case "ready":
|
|
66
|
+
g.observeUnit(testBinding(), 7, "", false, true, 0, end)
|
|
67
|
+
case "fence":
|
|
68
|
+
end = start.Add(unitQueryRecoveryBudget)
|
|
69
|
+
g.fenced(end)
|
|
70
|
+
case "signal-fence":
|
|
71
|
+
want = "fence"
|
|
72
|
+
g.fenceObserver("bus-owner-changed", observerEvent{At: end, Detail: "owner-signal"})
|
|
73
|
+
case "reload-fence":
|
|
74
|
+
want = "fence"
|
|
75
|
+
g.requestUnitCheck(true, start.Add(time.Second))
|
|
76
|
+
end = start.Add(unitQueryRecoveryBudget)
|
|
77
|
+
g.fenced(end)
|
|
78
|
+
}
|
|
79
|
+
d := g.observerDiagnostic("")
|
|
80
|
+
p := d.QueryPending
|
|
81
|
+
if p == nil || !p.StartedAt.Equal(start) || !p.PendingAt.Equal(start.Add(500*time.Millisecond)) || !p.EndedAt.Equal(end) || p.Outcome != want || p.ElapsedNS != int64(end.Sub(start)) || p.Phase != "get-owner" {
|
|
82
|
+
t.Fatalf("wrong ended period: %+v", p)
|
|
83
|
+
}
|
|
84
|
+
if want == "ready" {
|
|
85
|
+
if !g.allow(end) {
|
|
86
|
+
t.Fatal("recovered admission denied")
|
|
87
|
+
}
|
|
88
|
+
later := end.Add(100 * time.Millisecond)
|
|
89
|
+
g.deferUnitDeadline(0, later, later.Add(500*time.Millisecond), e)
|
|
90
|
+
if p = g.observerDiagnostic("").QueryPending; !p.StartedAt.Equal(later) || p.Outcome != "pending" || !p.EndedAt.IsZero() || p.ElapsedNS != 0 {
|
|
91
|
+
t.Fatalf("latest cycle not replaced: %+v", p)
|
|
92
|
+
}
|
|
93
|
+
} else {
|
|
94
|
+
g.observeUnit(testBinding(), 7, "", false, true, g.unitSerial, end)
|
|
95
|
+
if g.allow(end) || g.observerDiagnostic("").QueryPending.ElapsedNS != p.ElapsedNS {
|
|
96
|
+
t.Fatal("terminal period or fence changed")
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
func TestQueryPendingDiagnosticDiscardedProbeDoesNotStartOrEndPeriod(t *testing.T) {
|
|
104
|
+
start := time.Now()
|
|
105
|
+
g := newAdmission(testBinding())
|
|
106
|
+
if g.deferUnitDeadline(0, start, start, observerEvent{}) || g.observerDiagnostic("").QueryPending != nil {
|
|
107
|
+
t.Fatal("startup acquired pending")
|
|
108
|
+
}
|
|
109
|
+
g.observeUnit(testBinding(), 7, "", false, true, 0, start)
|
|
110
|
+
g.requestUnitCheck(true, start)
|
|
111
|
+
if g.deferUnitDeadline(0, start, start, observerEvent{}) || g.observerDiagnostic("").QueryPending != nil {
|
|
112
|
+
t.Fatal("obsolete probe started pending")
|
|
113
|
+
}
|
|
114
|
+
g.requestUnitCheck(false, start)
|
|
115
|
+
g.deferUnitDeadline(g.unitSerial, start, start.Add(500*time.Millisecond), observerEvent{Phase: "get-unit", ErrorClass: "deadline"})
|
|
116
|
+
g.observeUnit(testBinding(), 7, "", false, true, 0, start.Add(time.Second))
|
|
117
|
+
if p := g.observerDiagnostic("").QueryPending; p == nil || p.Outcome != "pending" {
|
|
118
|
+
t.Fatalf("obsolete success ended pending: %+v", p)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
func TestQueryPendingDiagnosticPersistsWhileOwnerLives(t *testing.T) {
|
|
123
|
+
for _, fail := range []bool{false, true} {
|
|
124
|
+
t.Run(map[bool]string{false: "private-file", true: "write-failure"}[fail], func(t *testing.T) {
|
|
125
|
+
c := fixture(t)
|
|
126
|
+
path := filepath.Join(c.StateDir, "observer-diagnostic.json")
|
|
127
|
+
if fail {
|
|
128
|
+
if err := os.Mkdir(path, 0700); err != nil {
|
|
129
|
+
t.Fatal(err)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
start := time.Now()
|
|
133
|
+
g := newAdmission(testBinding())
|
|
134
|
+
g.observeUnit(testBinding(), 7, "", false, true, 0, start)
|
|
135
|
+
stop := startObserverDiagnostics(c, strings.Repeat("e", 64), g)
|
|
136
|
+
defer stop()
|
|
137
|
+
g.deferUnitDeadline(0, start, start.Add(500*time.Millisecond), observerEvent{Phase: "get-all", ErrorClass: "deadline"})
|
|
138
|
+
read := func(want string) observerDiagnostic {
|
|
139
|
+
t.Helper()
|
|
140
|
+
deadline := time.Now().Add(2 * time.Second)
|
|
141
|
+
for time.Now().Before(deadline) {
|
|
142
|
+
b, err := os.ReadFile(path)
|
|
143
|
+
var d observerDiagnostic
|
|
144
|
+
if err == nil && json.Unmarshal(b, &d) == nil && d.QueryPending != nil && d.QueryPending.Outcome == want {
|
|
145
|
+
return d
|
|
146
|
+
}
|
|
147
|
+
time.Sleep(time.Millisecond)
|
|
148
|
+
}
|
|
149
|
+
t.Fatalf("live %s diagnostic not persisted", want)
|
|
150
|
+
return observerDiagnostic{}
|
|
151
|
+
}
|
|
152
|
+
if !fail {
|
|
153
|
+
read("pending")
|
|
154
|
+
}
|
|
155
|
+
end := start.Add(750 * time.Millisecond)
|
|
156
|
+
g.observeUnit(testBinding(), 7, "", false, true, 0, end)
|
|
157
|
+
if !g.allow(end) {
|
|
158
|
+
t.Fatal("write failure changed recovery")
|
|
159
|
+
}
|
|
160
|
+
if !fail {
|
|
161
|
+
d := read("ready")
|
|
162
|
+
if d.Reason != "" || d.Epoch != strings.Repeat("e", 64) || d.QueryPending.ElapsedNS != int64(750*time.Millisecond) {
|
|
163
|
+
t.Fatalf("bad live recovery: %+v", d)
|
|
164
|
+
}
|
|
165
|
+
st, err := os.Stat(path)
|
|
166
|
+
if err != nil || st.Mode().Perm() != 0600 || st.Size() > observerDiagnosticLimit {
|
|
167
|
+
t.Fatalf("bad private bounded file: %v %v", st, err)
|
|
168
|
+
}
|
|
169
|
+
g.deferUnitDeadline(0, end, end.Add(500*time.Millisecond), observerEvent{Phase: "get-unit", ErrorClass: "deadline"})
|
|
170
|
+
g.fenced(end.Add(unitQueryRecoveryBudget))
|
|
171
|
+
d = read("fence")
|
|
172
|
+
if d.QueryPending.ElapsedNS != int64(unitQueryRecoveryBudget) || d.Fence.Detail != "query-deadline" {
|
|
173
|
+
t.Fatalf("bad live fence: %+v", d)
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
})
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
func TestQueryPendingDiagnosticSlowWriterCannotDelayAdmission(t *testing.T) {
|
|
181
|
+
g := newAdmission(testBinding())
|
|
182
|
+
start := time.Now()
|
|
183
|
+
g.observeUnit(testBinding(), 7, "", false, true, 0, start)
|
|
184
|
+
entered := make(chan struct{})
|
|
185
|
+
release := make(chan struct{})
|
|
186
|
+
var writes atomic.Int32
|
|
187
|
+
stop := startObserverDiagnosticWriter(g, func() {
|
|
188
|
+
if writes.Add(1) == 1 {
|
|
189
|
+
close(entered)
|
|
190
|
+
<-release
|
|
191
|
+
}
|
|
192
|
+
})
|
|
193
|
+
// Always release before shutdown, including a failing assertion.
|
|
194
|
+
defer stop()
|
|
195
|
+
defer close(release)
|
|
196
|
+
select {
|
|
197
|
+
case <-entered:
|
|
198
|
+
case <-time.After(time.Second):
|
|
199
|
+
t.Fatal("writer not started")
|
|
200
|
+
}
|
|
201
|
+
done := make(chan struct{})
|
|
202
|
+
go func() {
|
|
203
|
+
// Repeated periods while storage is stalled must coalesce in bounded memory.
|
|
204
|
+
for n := 0; n < observerEventLimit*2; n++ {
|
|
205
|
+
at := start.Add(time.Duration(n) * time.Millisecond)
|
|
206
|
+
g.deferUnitDeadline(0, at, at.Add(time.Microsecond), observerEvent{Phase: "get-unit", ErrorClass: "deadline"})
|
|
207
|
+
g.observeUnit(testBinding(), 7, "", false, true, 0, at.Add(2*time.Microsecond))
|
|
208
|
+
}
|
|
209
|
+
g.deferUnitDeadline(0, start, start.Add(500*time.Millisecond), observerEvent{Phase: "get-unit", ErrorClass: "deadline"})
|
|
210
|
+
g.fenced(start.Add(unitQueryRecoveryBudget))
|
|
211
|
+
close(done)
|
|
212
|
+
}()
|
|
213
|
+
select {
|
|
214
|
+
case <-done:
|
|
215
|
+
case <-time.After(time.Second):
|
|
216
|
+
t.Fatal("storage blocked admission")
|
|
217
|
+
}
|
|
218
|
+
d := g.observerDiagnostic("")
|
|
219
|
+
if d.QueryPending == nil || d.QueryPending.Outcome != "fence" || d.QueryPending.ElapsedNS != int64(unitQueryRecoveryBudget) || len(d.Events) != observerEventLimit {
|
|
220
|
+
t.Fatalf("latest period lost: %+v", d)
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
func TestQueryPendingDiagnosticShutdownFlushesLatest(t *testing.T) {
|
|
225
|
+
g := newAdmission(testBinding())
|
|
226
|
+
start := time.Now()
|
|
227
|
+
g.observeUnit(testBinding(), 7, "", false, true, 0, start)
|
|
228
|
+
entered, release := make(chan struct{}), make(chan struct{})
|
|
229
|
+
var latest atomic.Pointer[observerDiagnostic]
|
|
230
|
+
var writes atomic.Int32
|
|
231
|
+
stop := startObserverDiagnosticWriter(g, func() {
|
|
232
|
+
if writes.Add(1) == 1 {
|
|
233
|
+
close(entered)
|
|
234
|
+
<-release
|
|
235
|
+
}
|
|
236
|
+
d := g.observerDiagnostic(strings.Repeat("e", 64))
|
|
237
|
+
latest.Store(&d)
|
|
238
|
+
})
|
|
239
|
+
defer stop()
|
|
240
|
+
select {
|
|
241
|
+
case <-entered:
|
|
242
|
+
case <-time.After(time.Second):
|
|
243
|
+
close(release)
|
|
244
|
+
t.Fatal("writer not started")
|
|
245
|
+
}
|
|
246
|
+
g.deferUnitDeadline(0, start, start.Add(500*time.Millisecond), observerEvent{Phase: "get-unit", ErrorClass: "deadline"})
|
|
247
|
+
g.observeUnit(testBinding(), 7, "", false, true, 0, start.Add(750*time.Millisecond))
|
|
248
|
+
close(release)
|
|
249
|
+
stop()
|
|
250
|
+
d := latest.Load()
|
|
251
|
+
if d == nil || d.QueryPending == nil || d.QueryPending.Outcome != "ready" || d.QueryPending.ElapsedNS != int64(750*time.Millisecond) {
|
|
252
|
+
t.Fatalf("shutdown lost latest: %+v", d)
|
|
253
|
+
}
|
|
254
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
package helper
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"context"
|
|
5
|
+
"crypto/rand"
|
|
6
|
+
"encoding/hex"
|
|
7
|
+
"encoding/json"
|
|
8
|
+
"errors"
|
|
9
|
+
"io"
|
|
10
|
+
"io/fs"
|
|
11
|
+
"net"
|
|
12
|
+
"os"
|
|
13
|
+
"path/filepath"
|
|
14
|
+
"syscall"
|
|
15
|
+
"time"
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
// Called by the already approved root child after SO_PEERCRED authorization.
|
|
19
|
+
// This endpoint can only withdraw the exact installed build's authority. It
|
|
20
|
+
// cannot start a process, select a path, signal a PID, or replace an inventory.
|
|
21
|
+
func packageRevoke(c Client, req Request) error {
|
|
22
|
+
if req.Op != "revoke" || req.Inventory != c.Expected || !c.Expected.Valid() || !digestPattern.MatchString(req.Nonce) {
|
|
23
|
+
return errTrust
|
|
24
|
+
}
|
|
25
|
+
if err := protected(c.StateDir, c.Owner, true); err != nil {
|
|
26
|
+
return err
|
|
27
|
+
}
|
|
28
|
+
f, err := os.OpenFile(filepath.Join(c.StateDir, "control.lock"), os.O_CREATE|os.O_RDWR|syscall.O_NOFOLLOW, 0600)
|
|
29
|
+
if err != nil {
|
|
30
|
+
return err
|
|
31
|
+
}
|
|
32
|
+
defer f.Close()
|
|
33
|
+
if err := protected(f.Name(), c.Owner, false); err != nil {
|
|
34
|
+
return err
|
|
35
|
+
}
|
|
36
|
+
if syscall.Flock(int(f.Fd()), syscall.LOCK_EX|syscall.LOCK_NB) != nil {
|
|
37
|
+
return errBusy
|
|
38
|
+
}
|
|
39
|
+
defer syscall.Flock(int(f.Fd()), syscall.LOCK_UN)
|
|
40
|
+
return policyUpdate(c, func(r *Record) error {
|
|
41
|
+
if r.Inventory != c.Expected || r.Lifecycle == nil || r.Lifecycle.Phase != "running" || !r.Enabled {
|
|
42
|
+
return errTrust
|
|
43
|
+
}
|
|
44
|
+
r.Enabled = false
|
|
45
|
+
r.Residual = true
|
|
46
|
+
r.Lifecycle.Phase = "fenced"
|
|
47
|
+
r.Lifecycle.Completion = ""
|
|
48
|
+
r.Lifecycle.Reason = "package-revoke"
|
|
49
|
+
return nil
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Revoke runs as the package UID. A socket acknowledgement proves only durable
|
|
54
|
+
// withdrawal; success additionally requires the owning supervisor's sealed
|
|
55
|
+
// terminal publication and absent runtime. No missing-socket shortcut.
|
|
56
|
+
func (c Client) Revoke(ctx context.Context) error {
|
|
57
|
+
ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
|
|
58
|
+
defer cancel()
|
|
59
|
+
r, err := readRecord(c.StateDir, c.Owner)
|
|
60
|
+
if errors.Is(err, fs.ErrNotExist) {
|
|
61
|
+
return c.CheckStopped(ctx)
|
|
62
|
+
}
|
|
63
|
+
// The new build may manage the old disabled terminal publication without
|
|
64
|
+
// acquiring its authority or mutating it. This keeps uninstall possible
|
|
65
|
+
// before the user has approved the upgraded build.
|
|
66
|
+
if err == nil && !r.Enabled && c.managementStopped(r) {
|
|
67
|
+
return nil
|
|
68
|
+
}
|
|
69
|
+
if err != nil || r.Inventory != c.Expected {
|
|
70
|
+
return errTrust
|
|
71
|
+
}
|
|
72
|
+
if !r.Enabled {
|
|
73
|
+
if c.managementStopped(r) {
|
|
74
|
+
return nil
|
|
75
|
+
}
|
|
76
|
+
return errTrust
|
|
77
|
+
}
|
|
78
|
+
if r.Lifecycle == nil || r.Lifecycle.Phase != "running" {
|
|
79
|
+
return errTrust
|
|
80
|
+
}
|
|
81
|
+
dialer := net.Dialer{Timeout: time.Second}
|
|
82
|
+
conn, err := dialer.DialContext(ctx, "unix", filepath.Join(c.RunDir, "helper.sock"))
|
|
83
|
+
if err != nil {
|
|
84
|
+
return err
|
|
85
|
+
}
|
|
86
|
+
defer conn.Close()
|
|
87
|
+
if c.Peer == nil || c.Peer(conn.(*net.UnixConn)) != nil {
|
|
88
|
+
return errTrust
|
|
89
|
+
}
|
|
90
|
+
conn.SetDeadline(time.Now().Add(time.Second))
|
|
91
|
+
var nonce [32]byte
|
|
92
|
+
if _, err := rand.Read(nonce[:]); err != nil {
|
|
93
|
+
return err
|
|
94
|
+
}
|
|
95
|
+
req := Request{Inventory: c.Expected, Op: "revoke", Nonce: hex.EncodeToString(nonce[:])}
|
|
96
|
+
if err := json.NewEncoder(conn).Encode(req); err != nil {
|
|
97
|
+
return err
|
|
98
|
+
}
|
|
99
|
+
var res Response
|
|
100
|
+
d := json.NewDecoder(io.LimitReader(conn, 4097))
|
|
101
|
+
d.DisallowUnknownFields()
|
|
102
|
+
if d.Decode(&res) != nil || res.Inventory != c.Expected || res.Nonce != req.Nonce || !res.OK || res.Error != "" {
|
|
103
|
+
return errTrust
|
|
104
|
+
}
|
|
105
|
+
return waitHealthy(ctx, func(context.Context) bool {
|
|
106
|
+
r, err := readRecord(c.StateDir, c.Owner)
|
|
107
|
+
return err == nil && r.Inventory == c.Expected && !r.Enabled && c.managementStopped(r)
|
|
108
|
+
})
|
|
109
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
package helper
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"context"
|
|
5
|
+
"net"
|
|
6
|
+
"os"
|
|
7
|
+
"path/filepath"
|
|
8
|
+
"strings"
|
|
9
|
+
"syscall"
|
|
10
|
+
"testing"
|
|
11
|
+
"time"
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
func TestPackageRevokeDurablyDisablesExactInventory(t *testing.T) {
|
|
15
|
+
c, _ := controlFixture(t)
|
|
16
|
+
r := Record{Inventory: c.Expected, Enabled: true, Lifecycle: testLifecycle("running")}
|
|
17
|
+
record(t, c.Client, r)
|
|
18
|
+
if err := packageRevoke(c.Client, Request{Inventory: c.Expected, Op: "revoke", Nonce: strings.Repeat("a", 64)}); err != nil {
|
|
19
|
+
t.Fatal(err)
|
|
20
|
+
}
|
|
21
|
+
got, err := readRecord(c.StateDir, c.Owner)
|
|
22
|
+
if err != nil || got.Enabled || !got.Residual || got.Lifecycle.Phase != "fenced" {
|
|
23
|
+
t.Fatalf("not durably revoked: %+v %v", got, err)
|
|
24
|
+
}
|
|
25
|
+
if c.CheckStopped(context.Background()) == nil {
|
|
26
|
+
t.Fatal("revocation acknowledgement accepted as completion")
|
|
27
|
+
}
|
|
28
|
+
if err := c.Control(context.Background(), "recover"); err == nil {
|
|
29
|
+
t.Fatal("revoked approval recovered")
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
func TestRevokeAcknowledgementCannotCertifyQuiescence(t *testing.T) {
|
|
34
|
+
c, _ := controlFixture(t)
|
|
35
|
+
live(t, c.Client, c.Expected, func(req Request) Response { return Response{Inventory: c.Expected, Nonce: req.Nonce, OK: true} })
|
|
36
|
+
ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)
|
|
37
|
+
defer cancel()
|
|
38
|
+
if c.Revoke(ctx) == nil {
|
|
39
|
+
t.Fatal("socket acknowledgement certified live process")
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
func TestRevokeRejectsUntrustedPeerAndWrongNonce(t *testing.T) {
|
|
44
|
+
for _, which := range []string{"peer", "nonce"} {
|
|
45
|
+
t.Run(which, func(t *testing.T) {
|
|
46
|
+
c, _ := controlFixture(t)
|
|
47
|
+
live(t, c.Client, c.Expected, func(req Request) Response { return Response{Inventory: c.Expected, Nonce: "wrong", OK: true} })
|
|
48
|
+
if which == "peer" {
|
|
49
|
+
c.Peer = func(*net.UnixConn) error { return errTrust }
|
|
50
|
+
}
|
|
51
|
+
if c.Revoke(context.Background()) == nil {
|
|
52
|
+
t.Fatal("untrusted response accepted")
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
func TestRevokeNewBuildConsumesOldDisabledTerminalWithoutMutation(t *testing.T) {
|
|
59
|
+
c, f := controlFixture(t)
|
|
60
|
+
l := testLifecycle("fenced")
|
|
61
|
+
if err := createLifetime(c.Client, l); err != nil {
|
|
62
|
+
t.Fatal(err)
|
|
63
|
+
}
|
|
64
|
+
record(t, c.Client, Record{Schema: 2, Inventory: c.Expected, Enabled: false, Residual: true, Lifecycle: l})
|
|
65
|
+
if err := cleanRuntime(c.Client, true); err != nil {
|
|
66
|
+
t.Fatal(err)
|
|
67
|
+
}
|
|
68
|
+
if err := completeRecord(c.Client, l.Epoch, f.current); err != nil {
|
|
69
|
+
t.Fatal(err)
|
|
70
|
+
}
|
|
71
|
+
before, _ := os.ReadFile(filepath.Join(c.StateDir, "approval.json"))
|
|
72
|
+
c.Expected.Version = "1.0.0-0002"
|
|
73
|
+
if err := c.Revoke(context.Background()); err != nil {
|
|
74
|
+
t.Fatal(err)
|
|
75
|
+
}
|
|
76
|
+
after, _ := os.ReadFile(filepath.Join(c.StateDir, "approval.json"))
|
|
77
|
+
if string(before) != string(after) {
|
|
78
|
+
t.Fatal("new build rewrote old publication")
|
|
79
|
+
}
|
|
80
|
+
if err := os.Remove(filepath.Join(c.StateDir, "completion-"+l.Epoch+".json")); err != nil {
|
|
81
|
+
t.Fatal(err)
|
|
82
|
+
}
|
|
83
|
+
if c.Revoke(context.Background()) == nil {
|
|
84
|
+
t.Fatal("missing terminal proof accepted")
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
func TestPackageRevokeRejectsWrongBuildInvalidFrameAndConcurrentEnable(t *testing.T) {
|
|
89
|
+
for _, kind := range []string{"build", "nonce", "operation", "busy"} {
|
|
90
|
+
t.Run(kind, func(t *testing.T) {
|
|
91
|
+
c, _ := controlFixture(t)
|
|
92
|
+
r := Record{Inventory: c.Expected, Enabled: true, Lifecycle: testLifecycle("running")}
|
|
93
|
+
record(t, c.Client, r)
|
|
94
|
+
req := Request{Inventory: c.Expected, Op: "revoke", Nonce: strings.Repeat("a", 64)}
|
|
95
|
+
switch kind {
|
|
96
|
+
case "build":
|
|
97
|
+
req.Inventory.Version = "0.1.0-0002"
|
|
98
|
+
case "nonce":
|
|
99
|
+
req.Nonce = ""
|
|
100
|
+
case "operation":
|
|
101
|
+
req.Op = "enable"
|
|
102
|
+
case "busy":
|
|
103
|
+
f, err := os.OpenFile(filepath.Join(c.StateDir, "control.lock"), os.O_CREATE|os.O_RDWR, 0600)
|
|
104
|
+
if err != nil {
|
|
105
|
+
t.Fatal(err)
|
|
106
|
+
}
|
|
107
|
+
defer f.Close()
|
|
108
|
+
if err := syscall.Flock(int(f.Fd()), syscall.LOCK_EX|syscall.LOCK_NB); err != nil {
|
|
109
|
+
t.Fatal(err)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if packageRevoke(c.Client, req) == nil {
|
|
113
|
+
t.Fatal("unsafe revoke accepted")
|
|
114
|
+
}
|
|
115
|
+
got, _ := readRecord(c.StateDir, c.Owner)
|
|
116
|
+
if !got.Enabled || got.Residual || got.Lifecycle.Phase != "running" {
|
|
117
|
+
t.Fatal("rejected request changed approval")
|
|
118
|
+
}
|
|
119
|
+
})
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -2,9 +2,12 @@ package helper
|
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
4
|
"context"
|
|
5
|
+
"errors"
|
|
5
6
|
"os"
|
|
6
7
|
"strings"
|
|
7
8
|
"testing"
|
|
9
|
+
|
|
10
|
+
"golang.org/x/sys/unix"
|
|
8
11
|
)
|
|
9
12
|
|
|
10
13
|
func s1rActorRaces(t *testing.T, spec s1rActorSpec, kind string) {
|
|
@@ -190,15 +193,31 @@ func s1rActorRaces(t *testing.T, spec s1rActorSpec, kind string) {
|
|
|
190
193
|
s1rMust(t, os.Chmod(root, 0500))
|
|
191
194
|
defer os.Chmod(root, 0700)
|
|
192
195
|
r, c := x.Commit(ctx)
|
|
193
|
-
|
|
194
|
-
// report it, and preserve the fail-closed publish gate.
|
|
195
|
-
if c != ErrUnsupported || r.Published || r.Committed || r.BytesWritten != 3 {
|
|
196
|
+
if c != ErrDenied || !r.Created || r.Published || r.Committed || r.BytesWritten != 3 {
|
|
196
197
|
t.Fatal("publish after parent chmod", r, c)
|
|
197
198
|
}
|
|
198
199
|
if _, e := os.Stat(root + "/result"); !os.IsNotExist(e) {
|
|
199
200
|
t.Fatal("publish wrote forbidden directory", e)
|
|
200
201
|
}
|
|
201
|
-
|
|
202
|
+
var st unix.Stat_t
|
|
203
|
+
s1rMust(t, unix.Fstat(int(x.file.Fd()), &st))
|
|
204
|
+
if st.Nlink != 0 || st.Size != 3 {
|
|
205
|
+
t.Fatal("anonymous stage changed after denial", st.Nlink, st.Size)
|
|
206
|
+
}
|
|
207
|
+
if retry, code := x.Commit(ctx); code != ErrReplay || retry != r {
|
|
208
|
+
t.Fatal("denied publish replay changed receipt", retry, code)
|
|
209
|
+
}
|
|
210
|
+
x.Close()
|
|
211
|
+
x.Close()
|
|
212
|
+
if _, e := x.file.Stat(); !errors.Is(e, os.ErrClosed) {
|
|
213
|
+
t.Fatal("stage descriptor still open", e)
|
|
214
|
+
}
|
|
215
|
+
entries, e := os.ReadDir(root)
|
|
216
|
+
s1rMust(t, e)
|
|
217
|
+
if len(entries) != 1 || entries[0].Name() != "file" {
|
|
218
|
+
t.Fatal("denied publish left a named stage", entries)
|
|
219
|
+
}
|
|
220
|
+
t.Log("parent write permission removed: publish denied; staged bytes and receipt retained; close leaves no named stage")
|
|
202
221
|
case "open-fd-write-permission-loss":
|
|
203
222
|
work := writeWork{RootPath: root, Action: ActionCreate, Segments: []string{"result"}, MaxBytes: 6}
|
|
204
223
|
x, c := openActorWriteTransfer(ctx, pin, work, fixtureReadOnlyACL{})
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//go:build linux && synopkgland_sdk_workers
|
|
2
|
+
|
|
3
|
+
package helper
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"context"
|
|
7
|
+
"dsmapp/internal/dsm"
|
|
8
|
+
"dsmapp/internal/filestation"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
type unavailableSDKValidator struct{}
|
|
12
|
+
|
|
13
|
+
func (unavailableSDKValidator) ValidateJob(context.Context, NativeActor, sdkJobRequest, Grant, sdkJobCheckpoint) (sdkJobProof, Code) {
|
|
14
|
+
return sdkJobProof{}, ErrUnavailable
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// The sole owner calls this once, after the authority's startup reconciliation.
|
|
18
|
+
// Native/POSIX services stay unavailable. Production uses only session-authenticated
|
|
19
|
+
// File Station requests; explicit native VM fixtures retain their own test seam.
|
|
20
|
+
func openSDKJobs(c Client, binary string, s *supervisorGrants, repo *FileGrantRepository) (*sdkJobOwner, Code, string) {
|
|
21
|
+
if len(sdkCompiledRegistry) == 0 {
|
|
22
|
+
return nil, ErrUnavailable, "jobs-registry"
|
|
23
|
+
}
|
|
24
|
+
journal, code, stage := newSDKFileJobJournalDiagnostic(repo)
|
|
25
|
+
if code != "" {
|
|
26
|
+
return nil, code, stage
|
|
27
|
+
}
|
|
28
|
+
var validator sdkJobValidator = unavailableSDKValidator{}
|
|
29
|
+
if v, ok := s.services.consent.(sdkJobValidator); ok {
|
|
30
|
+
validator = v
|
|
31
|
+
}
|
|
32
|
+
o, code := newSDKJobOwner(s, sdkCompiledRegistry, sdkJobServices{Validator: validator, Journal: journal, Start: func(a NativeActor, b operationBinding, p sdkJobPlan) (sdkJobProcess, error) {
|
|
33
|
+
return startLinuxSDKJob(c, binary, a, b, p)
|
|
34
|
+
}})
|
|
35
|
+
if code != "" {
|
|
36
|
+
return nil, code, "jobs-owner"
|
|
37
|
+
}
|
|
38
|
+
// Reuse the same retained journal/index for revocation. No observer, validator,
|
|
39
|
+
// ready/consume loop or background child bootstrap is installed.
|
|
40
|
+
if _, code = newSDKBackgroundOwner(o, nil, nil, journal, newSDKEpochClock()); code != "" {
|
|
41
|
+
return nil, code, "background-index"
|
|
42
|
+
}
|
|
43
|
+
if _, nativeFixture := s.services.consent.(sdkJobValidator); !nativeFixture {
|
|
44
|
+
o.session, code = newSDKSessionJobs(o, filestation.Local("/var/packages/"+c.Expected.Package+"/var"), dsm.NewAuthenticator())
|
|
45
|
+
if code != "" {
|
|
46
|
+
return nil, code, "session-history"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
newSDKJobViews(o)
|
|
50
|
+
return o, "", ""
|
|
51
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
//go:build synopkgland_sdk_workers
|
|
2
|
+
|
|
3
|
+
package helper
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"context"
|
|
7
|
+
"time"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
// Called only by the sole supervisor owner. The reference is bound to the
|
|
11
|
+
// immutable job record; no persisted deadline can survive owner restart.
|
|
12
|
+
func (o *sdkJobOwner) issueAttach(j *sdkJob) Code {
|
|
13
|
+
id, code := sdkRandomRef()
|
|
14
|
+
if code != "" {
|
|
15
|
+
return code
|
|
16
|
+
}
|
|
17
|
+
now := o.attachNow()
|
|
18
|
+
if now < 0 || now > time.Duration(1<<63-1)-sdkAttachTTL {
|
|
19
|
+
return ErrExpired
|
|
20
|
+
}
|
|
21
|
+
j.attach = &sdkAttachLease{id: id, principal: j.actor.Principal(), session: j.actor.SessionRef(), epoch: o.grants.cohort.epoch, last: now, deadline: now + sdkAttachTTL}
|
|
22
|
+
return ""
|
|
23
|
+
}
|
|
24
|
+
func (o *sdkJobOwner) attachExpired(j *sdkJob) bool {
|
|
25
|
+
a := j.attach
|
|
26
|
+
if a == nil || o.attachNow == nil {
|
|
27
|
+
return true
|
|
28
|
+
}
|
|
29
|
+
now := o.attachNow()
|
|
30
|
+
if a.denied || now < a.last || now >= a.deadline || a.epoch != o.grants.cohort.epoch {
|
|
31
|
+
a.denied = true
|
|
32
|
+
return true
|
|
33
|
+
}
|
|
34
|
+
a.last = now
|
|
35
|
+
return false
|
|
36
|
+
}
|
|
37
|
+
func (o *sdkJobOwner) renewAttach(ctx context.Context, carriers SessionCarriers, jobID, attachID string) Code {
|
|
38
|
+
j := o.jobs[jobID]
|
|
39
|
+
if j == nil || j.attach == nil || j.background != nil || !allReferences(attachID) || j.attach.id != attachID {
|
|
40
|
+
return ErrDenied
|
|
41
|
+
}
|
|
42
|
+
// Authenticate even denial paths, with no caller-selected identity or roles.
|
|
43
|
+
v := newSDKJobViews(o)
|
|
44
|
+
actor, code := v.actor(ctx, carriers)
|
|
45
|
+
if code != "" {
|
|
46
|
+
return code
|
|
47
|
+
}
|
|
48
|
+
if actor.Principal() != j.attach.principal || actor.SessionRef() != j.attach.session {
|
|
49
|
+
return ErrDenied
|
|
50
|
+
}
|
|
51
|
+
if j.terminal || j.failure != "" || j.receipt.Job.CancelRequested {
|
|
52
|
+
return ErrStale
|
|
53
|
+
}
|
|
54
|
+
expire := func() Code {
|
|
55
|
+
if code := o.cancelOwned(ctx, j); code != "" {
|
|
56
|
+
return code
|
|
57
|
+
}
|
|
58
|
+
return ErrExpired
|
|
59
|
+
}
|
|
60
|
+
if o.attachExpired(j) {
|
|
61
|
+
return expire()
|
|
62
|
+
}
|
|
63
|
+
if !o.grants.cohort.gate.allow(o.grants.cohort.now()) {
|
|
64
|
+
return ErrFenced
|
|
65
|
+
}
|
|
66
|
+
if code = v.budget(actor); code != "" {
|
|
67
|
+
return code
|
|
68
|
+
}
|
|
69
|
+
// Proof/budget work cannot renew a deadline which passed in the meantime.
|
|
70
|
+
if ctx.Err() != nil {
|
|
71
|
+
return nativeContextCode(ctx)
|
|
72
|
+
}
|
|
73
|
+
if o.attachExpired(j) {
|
|
74
|
+
return expire()
|
|
75
|
+
}
|
|
76
|
+
now := o.attachNow()
|
|
77
|
+
if now < j.attach.last || now >= j.attach.deadline || now > time.Duration(1<<63-1)-sdkAttachTTL {
|
|
78
|
+
j.attach.denied = true
|
|
79
|
+
return expire()
|
|
80
|
+
}
|
|
81
|
+
j.attach.last, j.attach.deadline = now, now+sdkAttachTTL
|
|
82
|
+
return ""
|
|
83
|
+
}
|