diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ea0aede --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,20 @@ +version: 2 +enable-beta-ecosystems: true + +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + + - package-ecosystem: "cargo" + directory: "/" + schedule: + interval: "daily" + versioning-strategy: lockfile-only + + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "daily" + versioning-strategy: increase diff --git a/.github/workflows/Dependabot.yml b/.github/workflows/Dependabot.yml new file mode 100644 index 0000000..cfa5b96 --- /dev/null +++ b/.github/workflows/Dependabot.yml @@ -0,0 +1,45 @@ +name: Dependabot + +concurrency: + group: Dependabot-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + security-events: write + contents: write + pull-requests: write + +on: + workflow_dispatch: + pull_request: + +jobs: + Approve: + runs-on: ubuntu-latest + + if: ${{ github.actor == 'dependabot[bot]' }} + + steps: + - uses: dependabot/fetch-metadata@v2.0.0 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + + - run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + + Merge: + runs-on: ubuntu-latest + + if: ${{ github.actor == 'dependabot[bot]' }} + + steps: + - uses: dependabot/fetch-metadata@v2.0.0 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + + - run: gh pr merge --auto --merge "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/GitHub.yml b/.github/workflows/GitHub.yml new file mode 100644 index 0000000..09e8b75 --- /dev/null +++ b/.github/workflows/GitHub.yml @@ -0,0 +1,57 @@ +name: GitHub + +concurrency: + group: GitHub-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + issues: write + pull-requests: write + +on: + issues: + types: [opened] + pull_request: + types: [opened] + +jobs: + Assign: + runs-on: ubuntu-latest + + env: + ADBLOCK: true + ASTRO_TELEMETRY_DISABLED: 1 + AUTOMATEDLAB_TELEMETRY_OPTOUT: 1 + AZURE_CORE_COLLECT_TELEMETRY: 0 + CHOOSENIM_NO_ANALYTICS: 1 + DIEZ_DO_NOT_TRACK: 1 + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + DOTNET_INTERACTIVE_CLI_TELEMETRY_OPTOUT: 1 + DO_NOT_TRACK: 1 + ET_NO_TELEMETRY: 1 + GATSBY_TELEMETRY_DISABLED: 1 + GATSBY_TELEMETRY_OPTOUT: 1 + GATSBY_TELEMETRY_OPT_OUT: 1 + GRIT_TELEMETRY_DISABLED: 1 + HASURA_GRAPHQL_ENABLE_TELEMETRY: false + HINT_TELEMETRY: off + HOMEBREW_NO_ANALYTICS: 1 + INFLUXD_REPORTING_DISABLED: true + ITERATIVE_DO_NOT_TRACK: 1 + NEXT_TELEMETRY_DEBUG: 1 + NEXT_TELEMETRY_DISABLED: 1 + NG_CLI_ANALYTICS: false + NUXT_TELEMETRY_DISABLED: 1 + PIN_DO_NOT_TRACK: 1 + POWERSHELL_TELEMETRY_OPTOUT: 1 + SAM_CLI_TELEMETRY: 0 + STNOUPGRADE: 1 + STRIPE_CLI_TELEMETRY_OPTOUT: 1 + TELEMETRY_DISABLED: 1 + + steps: + - uses: pozil/auto-assign-issue@v1.13.0 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + assignees: NikolaRHristov + numOfAssignee: 1 diff --git a/.github/workflows/NPM.yml b/.github/workflows/NPM.yml new file mode 100644 index 0000000..b0332f1 --- /dev/null +++ b/.github/workflows/NPM.yml @@ -0,0 +1,43 @@ +name: NPM + +concurrency: + group: NPM-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + security-events: write + contents: write + pull-requests: write + +on: + workflow_dispatch: + release: + types: [created] + workflow_call: + +jobs: + Publish: + runs-on: ubuntu-latest + + permissions: + contents: read + id-token: write + + steps: + - uses: actions/checkout@v4.1.2 + + - uses: actions/setup-node@v4.0.2 + with: + node-version: "18" + registry-url: "https://registry.npmjs.org" + + - run: npm install -g npm + + - name: Publish . + continue-on-error: true + working-directory: . + run: | + npm install --legacy-peer-deps + npm publish --legacy-peer-deps --provenance + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/Node.yml b/.github/workflows/Node.yml new file mode 100644 index 0000000..cd8ec65 --- /dev/null +++ b/.github/workflows/Node.yml @@ -0,0 +1,100 @@ +name: Node + +concurrency: + group: Node-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + security-events: write + contents: write + pull-requests: write + +on: + workflow_dispatch: + push: + branches: [Current] + pull_request: + branches: [Current] + workflow_call: + +jobs: + Pre-Publish: + runs-on: ubuntu-latest + + env: + ADBLOCK: true + ASTRO_TELEMETRY_DISABLED: 1 + AUTOMATEDLAB_TELEMETRY_OPTOUT: 1 + AZURE_CORE_COLLECT_TELEMETRY: 0 + CHOOSENIM_NO_ANALYTICS: 1 + DIEZ_DO_NOT_TRACK: 1 + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + DOTNET_INTERACTIVE_CLI_TELEMETRY_OPTOUT: 1 + DO_NOT_TRACK: 1 + ET_NO_TELEMETRY: 1 + GATSBY_TELEMETRY_DISABLED: 1 + GATSBY_TELEMETRY_OPTOUT: 1 + GATSBY_TELEMETRY_OPT_OUT: 1 + GRIT_TELEMETRY_DISABLED: 1 + HASURA_GRAPHQL_ENABLE_TELEMETRY: false + HINT_TELEMETRY: off + HOMEBREW_NO_ANALYTICS: 1 + INFLUXD_REPORTING_DISABLED: true + ITERATIVE_DO_NOT_TRACK: 1 + NEXT_TELEMETRY_DEBUG: 1 + NEXT_TELEMETRY_DISABLED: 1 + NG_CLI_ANALYTICS: false + NUXT_TELEMETRY_DISABLED: 1 + PIN_DO_NOT_TRACK: 1 + POWERSHELL_TELEMETRY_OPTOUT: 1 + SAM_CLI_TELEMETRY: 0 + STNOUPGRADE: 1 + STRIPE_CLI_TELEMETRY_OPTOUT: 1 + TELEMETRY_DISABLED: 1 + + strategy: + matrix: + node-version: [18, 19, 20] + + steps: + - uses: actions/checkout@v4.1.2 + + - uses: pnpm/action-setup@v3.0.0 + with: + version: 8.15.5 + run_install: | + - recursive: true + args: [ + --link-workspace-packages=true, + --lockfile-only, + --prefer-frozen-lockfile=false, + --shamefully-hoist=false, + --shared-workspace-lockfile=true, + --strict-peer-dependencies=false, + --unsafe-perm=true + ] + + - uses: actions/setup-node@v4.0.2 + with: + node-version: ${{ matrix.node-version }} + cache: "pnpm" + cache-dependency-path: ./pnpm-lock.yaml + + - run: pnpm install + working-directory: . + + - run: pnpm run build + working-directory: . + + - uses: actions/upload-artifact@v4.3.1 + with: + name: .-Node-${{ matrix.node-version }}-Target + path: ./Target + + - run: pnpm run prepublishOnly + working-directory: . + + - uses: actions/upload-artifact@v4.3.1 + with: + name: .-Node-${{ matrix.node-version }}-Target + path: ./Target diff --git a/.github/workflows/Rust.yml b/.github/workflows/Rust.yml new file mode 100644 index 0000000..8d5e11c --- /dev/null +++ b/.github/workflows/Rust.yml @@ -0,0 +1,78 @@ +name: Rust + +concurrency: + group: Rust-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + security-events: write + +on: + workflow_dispatch: + push: + branches: [Current] + pull_request: + branches: [Current] + workflow_call: + +jobs: + Build: + runs-on: ubuntu-latest + + env: + ADBLOCK: true + ASTRO_TELEMETRY_DISABLED: 1 + AUTOMATEDLAB_TELEMETRY_OPTOUT: 1 + AZURE_CORE_COLLECT_TELEMETRY: 0 + CHOOSENIM_NO_ANALYTICS: 1 + DIEZ_DO_NOT_TRACK: 1 + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + DOTNET_INTERACTIVE_CLI_TELEMETRY_OPTOUT: 1 + DO_NOT_TRACK: 1 + ET_NO_TELEMETRY: 1 + GATSBY_TELEMETRY_DISABLED: 1 + GATSBY_TELEMETRY_OPTOUT: 1 + GATSBY_TELEMETRY_OPT_OUT: 1 + GRIT_TELEMETRY_DISABLED: 1 + HASURA_GRAPHQL_ENABLE_TELEMETRY: false + HINT_TELEMETRY: off + HOMEBREW_NO_ANALYTICS: 1 + INFLUXD_REPORTING_DISABLED: true + ITERATIVE_DO_NOT_TRACK: 1 + NEXT_TELEMETRY_DEBUG: 1 + NEXT_TELEMETRY_DISABLED: 1 + NG_CLI_ANALYTICS: false + NUXT_TELEMETRY_DISABLED: 1 + PIN_DO_NOT_TRACK: 1 + POWERSHELL_TELEMETRY_OPTOUT: 1 + SAM_CLI_TELEMETRY: 0 + STNOUPGRADE: 1 + STRIPE_CLI_TELEMETRY_OPTOUT: 1 + TELEMETRY_DISABLED: 1 + + strategy: + matrix: + toolchain: ["stable", "nightly"] + + steps: + - uses: actions/checkout@v4.1.2 + + - uses: actions-rs/toolchain@v1.0.7 + with: + profile: minimal + toolchain: ${{ matrix.toolchain }} + + - uses: actions/cache@v4.0.1 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + Target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('./Cargo.toml') }} + - uses: actions-rs/cargo@v1.0.3 + with: + command: build + args: --release --all-features --manifest-path ./Cargo.toml diff --git a/Source/api-iife.js b/Source/api-iife.js index 90b2f35..1344a0e 100644 --- a/Source/api-iife.js +++ b/Source/api-iife.js @@ -1 +1,14 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_CLI__=function(_){"use strict";return"function"==typeof SuppressedError&&SuppressedError,_.getMatches=async function(){return await async function(_,n={},e){return window.__TAURI_INTERNALS__.invoke(_,n,e)}("plugin:cli|cli_matches")},_}({});Object.defineProperty(window.__TAURI__,"cli",{value:__TAURI_PLUGIN_CLI__})} +if ("__TAURI__" in window) { + var __TAURI_PLUGIN_CLI__ = ((_) => ( + "function" == typeof SuppressedError && SuppressedError, + (_.getMatches = async () => + await (async (_, n = {}, e) => + window.__TAURI_INTERNALS__.invoke(_, n, e))( + "plugin:cli|cli_matches", + )), + _ + ))({}); + Object.defineProperty(window.__TAURI__, "cli", { + value: __TAURI_PLUGIN_CLI__, + }); +} diff --git a/dist-js/index.cjs b/dist-js/index.cjs index 4c62075..b418dc0 100644 --- a/dist-js/index.cjs +++ b/dist-js/index.cjs @@ -1,6 +1,6 @@ -'use strict'; +"use strict"; -var core = require('@tauri-apps/api/core'); +var core = require("@tauri-apps/api/core"); // Copyright 2019-2023 Tauri Programme within The Commons Conservancy // SPDX-License-Identifier: Apache-2.0 @@ -32,7 +32,7 @@ var core = require('@tauri-apps/api/core'); * @since 2.0.0 */ async function getMatches() { - return await core.invoke("plugin:cli|cli_matches"); + return await core.invoke("plugin:cli|cli_matches"); } exports.getMatches = getMatches; diff --git a/dist-js/index.d.ts b/dist-js/index.d.ts index 00a330e..0e570c4 100644 --- a/dist-js/index.d.ts +++ b/dist-js/index.d.ts @@ -2,30 +2,30 @@ * @since 2.0.0 */ interface ArgMatch { - /** - * string if takes value - * boolean if flag - * string[] or null if takes multiple values - */ - value: string | boolean | string[] | null; - /** - * Number of occurrences - */ - occurrences: number; + /** + * string if takes value + * boolean if flag + * string[] or null if takes multiple values + */ + value: string | boolean | string[] | null; + /** + * Number of occurrences + */ + occurrences: number; } /** * @since 2.0.0 */ interface SubcommandMatch { - name: string; - matches: CliMatches; + name: string; + matches: CliMatches; } /** * @since 2.0.0 */ interface CliMatches { - args: Record; - subcommand: SubcommandMatch | null; + args: Record; + subcommand: SubcommandMatch | null; } /** * Parse the arguments provided to the current process and get the matches using the configuration defined [`tauri.cli`](https://tauri.app/v1/api/config/#tauriconfig.cli) in `tauri.conf.json` diff --git a/dist-js/index.js b/dist-js/index.js index 74e3182..02b9e4a 100644 --- a/dist-js/index.js +++ b/dist-js/index.js @@ -1,4 +1,4 @@ -import { invoke } from '@tauri-apps/api/core'; +import { invoke } from "@tauri-apps/api/core"; // Copyright 2019-2023 Tauri Programme within The Commons Conservancy // SPDX-License-Identifier: Apache-2.0 @@ -30,7 +30,7 @@ import { invoke } from '@tauri-apps/api/core'; * @since 2.0.0 */ async function getMatches() { - return await invoke("plugin:cli|cli_matches"); + return await invoke("plugin:cli|cli_matches"); } export { getMatches }; diff --git a/guest-js/index.ts b/guest-js/index.ts index 0ab7868..83e1655 100644 --- a/guest-js/index.ts +++ b/guest-js/index.ts @@ -14,32 +14,32 @@ import { invoke } from "@tauri-apps/api/core"; * @since 2.0.0 */ interface ArgMatch { - /** - * string if takes value - * boolean if flag - * string[] or null if takes multiple values - */ - value: string | boolean | string[] | null; - /** - * Number of occurrences - */ - occurrences: number; + /** + * string if takes value + * boolean if flag + * string[] or null if takes multiple values + */ + value: string | boolean | string[] | null; + /** + * Number of occurrences + */ + occurrences: number; } /** * @since 2.0.0 */ interface SubcommandMatch { - name: string; - matches: CliMatches; + name: string; + matches: CliMatches; } /** * @since 2.0.0 */ interface CliMatches { - args: Record; - subcommand: SubcommandMatch | null; + args: Record; + subcommand: SubcommandMatch | null; } /** @@ -64,7 +64,7 @@ interface CliMatches { * @since 2.0.0 */ async function getMatches(): Promise { - return await invoke("plugin:cli|cli_matches"); + return await invoke("plugin:cli|cli_matches"); } export type { ArgMatch, SubcommandMatch, CliMatches }; diff --git a/package.json b/package.json index 0fb9861..4f31f6a 100644 --- a/package.json +++ b/package.json @@ -25,11 +25,7 @@ "main": "./dist-js/index.cjs", "module": "./dist-js/index.js", "types": "./dist-js/index.d.ts", - "files": [ - "dist-js", - "README.md", - "LICENSE" - ], + "files": ["dist-js", "README.md", "LICENSE"], "scripts": { "build": "rollup -c", "prepublishOnly": "TypeScriptESBuild 'Source/**/*.ts'" @@ -43,7 +39,5 @@ "publishConfig": { "access": "public" }, - "authors": [ - "Tauri Programme within The Commons Conservancy" - ] + "authors": ["Tauri Programme within The Commons Conservancy"] } diff --git a/permissions/schemas/schema.json b/permissions/schemas/schema.json index 4552dc2..18b1fe2 100644 --- a/permissions/schemas/schema.json +++ b/permissions/schemas/schema.json @@ -1,325 +1,277 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "PermissionFile", - "description": "Permission file that can define a default permission, a set of permissions or a list of inlined permissions.", - "type": "object", - "properties": { - "default": { - "description": "The default permission set for the plugin", - "anyOf": [ - { - "$ref": "#/definitions/DefaultPermission" - }, - { - "type": "null" - } - ] - }, - "set": { - "description": "A list of permissions sets defined", - "type": "array", - "items": { - "$ref": "#/definitions/PermissionSet" - } - }, - "permission": { - "description": "A list of inlined permissions", - "default": [], - "type": "array", - "items": { - "$ref": "#/definitions/Permission" - } - } - }, - "definitions": { - "DefaultPermission": { - "description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.", - "type": "object", - "required": [ - "permissions" - ], - "properties": { - "version": { - "description": "The version of the permission.", - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 1.0 - }, - "description": { - "description": "Human-readable description of what the permission does.", - "type": [ - "string", - "null" - ] - }, - "permissions": { - "description": "All permissions this set contains.", - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "PermissionSet": { - "description": "A set of direct permissions grouped together under a new name.", - "type": "object", - "required": [ - "description", - "identifier", - "permissions" - ], - "properties": { - "identifier": { - "description": "A unique identifier for the permission.", - "type": "string" - }, - "description": { - "description": "Human-readable description of what the permission does.", - "type": "string" - }, - "permissions": { - "description": "All permissions this set contains.", - "type": "array", - "items": { - "$ref": "#/definitions/PermissionKind" - } - } - } - }, - "Permission": { - "description": "Descriptions of explicit privileges of commands.\n\nIt can enable commands to be accessible in the frontend of the application.\n\nIf the scope is defined it can be used to fine grain control the access of individual or multiple commands.", - "type": "object", - "required": [ - "identifier" - ], - "properties": { - "version": { - "description": "The version of the permission.", - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 1.0 - }, - "identifier": { - "description": "A unique identifier for the permission.", - "type": "string" - }, - "description": { - "description": "Human-readable description of what the permission does.", - "type": [ - "string", - "null" - ] - }, - "commands": { - "description": "Allowed or denied commands when using this permission.", - "default": { - "allow": [], - "deny": [] - }, - "allOf": [ - { - "$ref": "#/definitions/Commands" - } - ] - }, - "scope": { - "description": "Allowed or denied scoped when using this permission.", - "allOf": [ - { - "$ref": "#/definitions/Scopes" - } - ] - }, - "platforms": { - "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", - "default": [ - "linux", - "macOS", - "windows", - "android", - "iOS" - ], - "type": "array", - "items": { - "$ref": "#/definitions/Target" - } - } - } - }, - "Commands": { - "description": "Allowed and denied commands inside a permission.\n\nIf two commands clash inside of `allow` and `deny`, it should be denied by default.", - "type": "object", - "properties": { - "allow": { - "description": "Allowed command.", - "default": [], - "type": "array", - "items": { - "type": "string" - } - }, - "deny": { - "description": "Denied command, which takes priority.", - "default": [], - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "Scopes": { - "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", - "type": "object", - "properties": { - "allow": { - "description": "Data that defines what is allowed by the scope.", - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/definitions/Value" - } - }, - "deny": { - "description": "Data that defines what is denied by the scope.", - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - "Value": { - "description": "All supported ACL values.", - "anyOf": [ - { - "description": "Represents a null JSON value.", - "type": "null" - }, - { - "description": "Represents a [`bool`].", - "type": "boolean" - }, - { - "description": "Represents a valid ACL [`Number`].", - "allOf": [ - { - "$ref": "#/definitions/Number" - } - ] - }, - { - "description": "Represents a [`String`].", - "type": "string" - }, - { - "description": "Represents a list of other [`Value`]s.", - "type": "array", - "items": { - "$ref": "#/definitions/Value" - } - }, - { - "description": "Represents a map of [`String`] keys to [`Value`]s.", - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/Value" - } - } - ] - }, - "Number": { - "description": "A valid ACL number.", - "anyOf": [ - { - "description": "Represents an [`i64`].", - "type": "integer", - "format": "int64" - }, - { - "description": "Represents a [`f64`].", - "type": "number", - "format": "double" - } - ] - }, - "Target": { - "description": "Platform target.", - "oneOf": [ - { - "description": "MacOS.", - "type": "string", - "enum": [ - "macOS" - ] - }, - { - "description": "Windows.", - "type": "string", - "enum": [ - "windows" - ] - }, - { - "description": "Linux.", - "type": "string", - "enum": [ - "linux" - ] - }, - { - "description": "Android.", - "type": "string", - "enum": [ - "android" - ] - }, - { - "description": "iOS.", - "type": "string", - "enum": [ - "iOS" - ] - } - ] - }, - "PermissionKind": { - "type": "string", - "oneOf": [ - { - "description": "allow-cli-matches -> Enables the cli_matches command without any pre-configured scope.", - "type": "string", - "enum": [ - "allow-cli-matches" - ] - }, - { - "description": "deny-cli-matches -> Denies the cli_matches command without any pre-configured scope.", - "type": "string", - "enum": [ - "deny-cli-matches" - ] - }, - { - "description": "default -> Allows reading the CLI matches", - "type": "string", - "enum": [ - "default" - ] - } - ] - } - } -} \ No newline at end of file + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PermissionFile", + "description": "Permission file that can define a default permission, a set of permissions or a list of inlined permissions.", + "type": "object", + "properties": { + "default": { + "description": "The default permission set for the plugin", + "anyOf": [ + { + "$ref": "#/definitions/DefaultPermission" + }, + { + "type": "null" + } + ] + }, + "set": { + "description": "A list of permissions sets defined", + "type": "array", + "items": { + "$ref": "#/definitions/PermissionSet" + } + }, + "permission": { + "description": "A list of inlined permissions", + "default": [], + "type": "array", + "items": { + "$ref": "#/definitions/Permission" + } + } + }, + "definitions": { + "DefaultPermission": { + "description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.", + "type": "object", + "required": ["permissions"], + "properties": { + "version": { + "description": "The version of the permission.", + "type": ["integer", "null"], + "format": "uint64", + "minimum": 1.0 + }, + "description": { + "description": "Human-readable description of what the permission does.", + "type": ["string", "null"] + }, + "permissions": { + "description": "All permissions this set contains.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "PermissionSet": { + "description": "A set of direct permissions grouped together under a new name.", + "type": "object", + "required": ["description", "identifier", "permissions"], + "properties": { + "identifier": { + "description": "A unique identifier for the permission.", + "type": "string" + }, + "description": { + "description": "Human-readable description of what the permission does.", + "type": "string" + }, + "permissions": { + "description": "All permissions this set contains.", + "type": "array", + "items": { + "$ref": "#/definitions/PermissionKind" + } + } + } + }, + "Permission": { + "description": "Descriptions of explicit privileges of commands.\n\nIt can enable commands to be accessible in the frontend of the application.\n\nIf the scope is defined it can be used to fine grain control the access of individual or multiple commands.", + "type": "object", + "required": ["identifier"], + "properties": { + "version": { + "description": "The version of the permission.", + "type": ["integer", "null"], + "format": "uint64", + "minimum": 1.0 + }, + "identifier": { + "description": "A unique identifier for the permission.", + "type": "string" + }, + "description": { + "description": "Human-readable description of what the permission does.", + "type": ["string", "null"] + }, + "commands": { + "description": "Allowed or denied commands when using this permission.", + "default": { + "allow": [], + "deny": [] + }, + "allOf": [ + { + "$ref": "#/definitions/Commands" + } + ] + }, + "scope": { + "description": "Allowed or denied scoped when using this permission.", + "allOf": [ + { + "$ref": "#/definitions/Scopes" + } + ] + }, + "platforms": { + "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", + "default": ["linux", "macOS", "windows", "android", "iOS"], + "type": "array", + "items": { + "$ref": "#/definitions/Target" + } + } + } + }, + "Commands": { + "description": "Allowed and denied commands inside a permission.\n\nIf two commands clash inside of `allow` and `deny`, it should be denied by default.", + "type": "object", + "properties": { + "allow": { + "description": "Allowed command.", + "default": [], + "type": "array", + "items": { + "type": "string" + } + }, + "deny": { + "description": "Denied command, which takes priority.", + "default": [], + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "Scopes": { + "description": "A restriction of the command/endpoint functionality.\n\nIt can be of any serde serializable type and is used for allowing or preventing certain actions inside a Tauri command.\n\nThe scope is passed to the command and handled/enforced by the command itself.", + "type": "object", + "properties": { + "allow": { + "description": "Data that defines what is allowed by the scope.", + "type": ["array", "null"], + "items": { + "$ref": "#/definitions/Value" + } + }, + "deny": { + "description": "Data that defines what is denied by the scope.", + "type": ["array", "null"], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + "Value": { + "description": "All supported ACL values.", + "anyOf": [ + { + "description": "Represents a null JSON value.", + "type": "null" + }, + { + "description": "Represents a [`bool`].", + "type": "boolean" + }, + { + "description": "Represents a valid ACL [`Number`].", + "allOf": [ + { + "$ref": "#/definitions/Number" + } + ] + }, + { + "description": "Represents a [`String`].", + "type": "string" + }, + { + "description": "Represents a list of other [`Value`]s.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + }, + { + "description": "Represents a map of [`String`] keys to [`Value`]s.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/Value" + } + } + ] + }, + "Number": { + "description": "A valid ACL number.", + "anyOf": [ + { + "description": "Represents an [`i64`].", + "type": "integer", + "format": "int64" + }, + { + "description": "Represents a [`f64`].", + "type": "number", + "format": "double" + } + ] + }, + "Target": { + "description": "Platform target.", + "oneOf": [ + { + "description": "MacOS.", + "type": "string", + "enum": ["macOS"] + }, + { + "description": "Windows.", + "type": "string", + "enum": ["windows"] + }, + { + "description": "Linux.", + "type": "string", + "enum": ["linux"] + }, + { + "description": "Android.", + "type": "string", + "enum": ["android"] + }, + { + "description": "iOS.", + "type": "string", + "enum": ["iOS"] + } + ] + }, + "PermissionKind": { + "type": "string", + "oneOf": [ + { + "description": "allow-cli-matches -> Enables the cli_matches command without any pre-configured scope.", + "type": "string", + "enum": ["allow-cli-matches"] + }, + { + "description": "deny-cli-matches -> Denies the cli_matches command without any pre-configured scope.", + "type": "string", + "enum": ["deny-cli-matches"] + }, + { + "description": "default -> Allows reading the CLI matches", + "type": "string", + "enum": ["default"] + } + ] + } + } +} diff --git a/tsconfig.json b/tsconfig.json index 5098169..56b42b0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,4 +1,4 @@ { - "extends": "../../tsconfig.base.json", - "include": ["guest-js/*.ts"] + "extends": "../../tsconfig.base.json", + "include": ["guest-js/*.ts"] }