diff --git a/.env.example b/.env.example index 9ba4011c0..0e8699fc9 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,5 @@ PUBLIC_CONSOLE_MODE=self-hosted -PUBLIC_CONSOLE_FEATURE_FLAGS= +PUBLIC_CONSOLE_FEATURE_FLAGS=sites,csv-import,attribute-encrypt PUBLIC_APPWRITE_MULTI_REGION=false PUBLIC_APPWRITE_ENDPOINT=http://localhost/v1 PUBLIC_STRIPE_KEY= diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d1c879a6e..7073e19f1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -79,7 +79,7 @@ jobs: labels: ${{ steps.meta.outputs.labels }} build-args: | "PUBLIC_CONSOLE_MODE=cloud" - "PUBLIC_CONSOLE_FEATURE_FLAGS=sites,csv-import" + "PUBLIC_CONSOLE_FEATURE_FLAGS=sites,csv-import,attribute-encrypt" "PUBLIC_APPWRITE_MULTI_REGION=true" "PUBLIC_GROWTH_ENDPOINT=${{ secrets.PUBLIC_GROWTH_ENDPOINT }}" "PUBLIC_STRIPE_KEY=${{ secrets.PUBLIC_STRIPE_KEY_STAGE }}" @@ -118,7 +118,7 @@ jobs: build-args: | "PUBLIC_CONSOLE_MODE=self-hosted" "PUBLIC_APPWRITE_MULTI_REGION=false" - "PUBLIC_CONSOLE_FEATURE_FLAGS=sites,csv-import" + "PUBLIC_CONSOLE_FEATURE_FLAGS=sites,csv-import,attribute-encrypt" "PUBLIC_GROWTH_ENDPOINT=${{ secrets.PUBLIC_GROWTH_ENDPOINT }}" publish-cloud-no-regions: @@ -156,6 +156,6 @@ jobs: build-args: | "PUBLIC_CONSOLE_MODE=cloud" "PUBLIC_APPWRITE_MULTI_REGION=false" - "PUBLIC_CONSOLE_FEATURE_FLAGS=sites,csv-import" + "PUBLIC_CONSOLE_FEATURE_FLAGS=sites,csv-import,attribute-encrypt" "PUBLIC_STRIPE_KEY=${{ secrets.PUBLIC_STRIPE_KEY_STAGE }}" "PUBLIC_GROWTH_ENDPOINT=${{ secrets.PUBLIC_GROWTH_ENDPOINT }}" diff --git a/package.json b/package.json index 6bc1eb196..f12341aef 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ }, "dependencies": { "@ai-sdk/svelte": "^1.1.24", - "@appwrite.io/console": "https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@a5e5564", + "@appwrite.io/console": "^1.9.0", "@appwrite.io/pink-icons": "0.25.0", "@appwrite.io/pink-icons-svelte": "^2.0.0-RC.1", "@appwrite.io/pink-legacy": "^1.0.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5f6146e7c..a3664a807 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^1.1.24 version: 1.1.24(svelte@5.25.3)(zod@3.24.3) '@appwrite.io/console': - specifier: https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@a5e5564 - version: https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@a5e5564 + specifier: ^1.9.0 + version: 1.9.0 '@appwrite.io/pink-icons': specifier: 0.25.0 version: 0.25.0 @@ -257,9 +257,8 @@ packages: '@analytics/type-utils@0.6.2': resolution: {integrity: sha512-TD+xbmsBLyYy/IxFimW/YL/9L2IEnM7/EoV9Aeh56U64Ify8o27HJcKjo38XY9Tcn0uOq1AX3thkKgvtWvwFQg==} - '@appwrite.io/console@https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@a5e5564': - resolution: {tarball: https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@a5e5564} - version: 1.8.0 + '@appwrite.io/console@1.9.0': + resolution: {integrity: sha512-g8+zfdBF8mz7tRUER4CGVe5FHWQVLp8TlY/UOGCZ2TgUF1qnpNu/DhiQgph8uF+QZ9jDKCLAAZlP5//9t7ckWA==} '@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@ee1b7788cd3f877c9aa1b6487976bd63a6196870': resolution: {tarball: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@ee1b7788cd3f877c9aa1b6487976bd63a6196870} @@ -1341,8 +1340,8 @@ packages: '@types/prop-types@15.7.14': resolution: {integrity: sha512-gNMvNH49DJ7OJYv+KAKn0Xp45p8PLl6zo2YnvDIbTd4J6MER2BmWN49TG7n9LvkyihINxeKW8+3bfS2yDC9dzQ==} - '@types/react@18.3.22': - resolution: {integrity: sha512-vUhG0YmQZ7kL/tmKLrD3g5zXbXXreZXB3pmROW8bg3CnLnpjkRVwUlLne7Ufa2r9yJ8+/6B73RzhAek5TBKh2Q==} + '@types/react@18.3.23': + resolution: {integrity: sha512-/LDXMQh55EzZQ0uVAZmKKhfENivEvWz6E+EYzh+/MCjMhNsotd+ZHhBGIjFDTi6+fz0OhQQQLbTgdQIxxCsC0w==} '@types/remarkable@2.0.8': resolution: {integrity: sha512-eKXqPZfpQl1kOADjdKchHrp2gwn9qMnGXhH/AtZe0UrklzhGJkawJo/Y/D0AlWcdWoWamFNIum8+/nkAISQVGg==} @@ -3636,7 +3635,7 @@ snapshots: '@analytics/type-utils@0.6.2': {} - '@appwrite.io/console@https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@a5e5564': {} + '@appwrite.io/console@1.9.0': {} '@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@ee1b7788cd3f877c9aa1b6487976bd63a6196870(svelte@5.25.3)': dependencies: @@ -4792,7 +4791,7 @@ snapshots: '@types/prop-types@15.7.14': {} - '@types/react@18.3.22': + '@types/react@18.3.23': dependencies: '@types/prop-types': 15.7.14 csstype: 3.1.3 @@ -6753,7 +6752,7 @@ snapshots: svelte-motion@0.12.2(svelte@5.25.3): dependencies: - '@types/react': 18.3.22 + '@types/react': 18.3.23 framesync: 6.1.2 popmotion: 11.0.5 style-value-types: 5.1.2 diff --git a/src/lib/flags.ts b/src/lib/flags.ts index 54d5ba576..3c00ee6dc 100644 --- a/src/lib/flags.ts +++ b/src/lib/flags.ts @@ -20,5 +20,6 @@ function isFlagEnabled(name: string) { export const flags = { showSites: isFlagEnabled('sites'), - showCsvImport: isFlagEnabled('csv-import') + showCsvImport: isFlagEnabled('csv-import'), + showAttributeEncrypt: isFlagEnabled('attribute-encrypt') }; diff --git a/src/lib/helpers/types.ts b/src/lib/helpers/types.ts index 543fa39ba..7f4e6a66e 100644 --- a/src/lib/helpers/types.ts +++ b/src/lib/helpers/types.ts @@ -44,6 +44,7 @@ export type Column = PinkColumn & { format?: string; exclude?: boolean; elements?: string[] | { value: string | number; label: string }[]; + encrypt?: boolean; }; export function isValueOfStringEnum>( diff --git a/src/lib/sdk/billing.ts b/src/lib/sdk/billing.ts index 95842f6c7..d84f15967 100644 --- a/src/lib/sdk/billing.ts +++ b/src/lib/sdk/billing.ts @@ -310,6 +310,7 @@ export type Plan = { users: number; teams: number; databases: number; + databasesAllowEncrypt: boolean; buckets: number; fileSize: number; functions: number; diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/+page.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/+page.svelte index acad8b897..e94163b7b 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/+page.svelte @@ -13,10 +13,11 @@ Link, Popover, Table, + Tooltip, Typography } from '@appwrite.io/pink-svelte'; import Create from '../createAttribute.svelte'; - import { isRelationship } from '../document-[document]/attributes/store'; + import { isRelationship, isString } from '../document-[document]/attributes/store'; import FailedModal from '../failedModal.svelte'; import CreateIndex from '../indexes/createIndex.svelte'; import { attributes, type Attributes, isCsvImportInProgress } from '../store'; @@ -33,7 +34,8 @@ IconPlus, IconSwitchHorizontal, IconTrash, - IconViewList + IconViewList, + IconLockClosed } from '@appwrite.io/pink-icons-svelte'; import type { ComponentProps } from 'svelte'; import { Click, trackEvent } from '$lib/actions/analytics'; @@ -112,25 +114,38 @@ {:else} {/if} - {attribute.key} - {#if attribute.status !== 'available'} - - {#if attribute.error} - { - e.preventDefault(); - error = attribute.error; - showFailed = true; - }}>Details + + + {attribute.key} + {#if isString(attribute) && attribute.encrypt} + + +
Encrypted
+
+ {/if} +
+ {#if attribute.status !== 'available'} + + {#if attribute.error} + { + e.preventDefault(); + error = attribute.error; + showFailed = true; + }}>Details + {/if} + {:else if attribute.required} + {/if} - {:else if attribute.required} - - {/if} +
diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/boolean.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/boolean.svelte index 9959b7229..911154864 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/boolean.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/boolean.svelte @@ -100,5 +100,4 @@ label="Array" bind:checked={data.array} disabled={data.required || editing} - description="Indicate whether this attribute should act as an array, with the default value set as an empty - array." /> + description="Indicate whether this attribute is an array. Defaults to an empty array." /> diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/datetime.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/datetime.svelte index cb40c72c9..1464c8c12 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/datetime.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/datetime.svelte @@ -92,5 +92,4 @@ label="Array" bind:checked={data.array} disabled={data.required || editing} - description="Indicate whether this attribute should act as an array, with the default value set as an empty - array." /> + description="Indicate whether this attribute is an array. Defaults to an empty array." /> diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/email.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/email.svelte index 07faa118f..9aa79bfc5 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/email.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/email.svelte @@ -93,5 +93,4 @@ label="Array" bind:checked={data.array} disabled={data.required || editing} - description="Indicate whether this attribute should act as an array, with the default value set as an empty - array." /> + description="Indicate whether this attribute is an array. Defaults to an empty array." /> diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/enum.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/enum.svelte index 2eed37bb1..b617dc82c 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/enum.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/enum.svelte @@ -124,5 +124,4 @@ label="Array" bind:checked={data.array} disabled={data.required || editing} - description="Indicate whether this attribute should act as an array, with the default value set as an empty - array." /> + description="Indicate whether this attribute is an array. Defaults to an empty array." /> diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/float.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/float.svelte index 2480a2d97..5c8646605 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/float.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/float.svelte @@ -122,5 +122,4 @@ label="Array" bind:checked={data.array} disabled={data.required || editing} - description="Indicate whether this attribute should act as an array, with the default value set as an empty - array." /> + description="Indicate whether this attribute is an array. Defaults to an empty array." /> diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/integer.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/integer.svelte index de97fccff..faa220fa0 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/integer.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/integer.svelte @@ -120,5 +120,4 @@ label="Array" bind:checked={data.array} disabled={data.required || editing} - description="Indicate whether this attribute should act as an array, with the default value set as an empty - array." /> + description="Indicate whether this attribute is an array. Defaults to an empty array." /> diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/ip.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/ip.svelte index a097bcbbd..5ae8043d9 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/ip.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/ip.svelte @@ -92,5 +92,4 @@ label="Array" bind:checked={data.array} disabled={data.required || editing} - description="Indicate whether this attribute should act as an array, with the default value set as an empty - array." /> + description="Indicate whether this attribute is an array. Defaults to an empty array." /> diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/string.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/string.svelte index 8bfc5e18a..3b4a60eb4 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/string.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/string.svelte @@ -18,7 +18,8 @@ data.size, data.required, data.default, - data.array + data.array, + data.encrypt ); } export async function updateString( @@ -42,20 +43,28 @@ -{#if data.size >= 50} - -{:else} - -{/if} + min={supportsStringEncryption && data.encrypt ? 150 : undefined} + helper={supportsStringEncryption && data.encrypt + ? 'Encrypted string attributes require a minimum size of 150.' + : undefined} /> + += 50 ? InputTextarea : InputText} + id="default" + label="Default" + placeholder="Enter string" + maxlength={data.size} + bind:value={data.default} + disabled={data.required || data.array} + nullable={!data.required && !data.array} /> + + description="Indicate whether this attribute is required." /> + + description="Indicate whether this attribute is an array. Defaults to an empty array." /> + +{#if showEncrypt} + +
+ + + + + + + + Indicate whether this attribute is encrypted. Encrypted attributes + cannot be queried. + + + + + + Available on Pro plan. Upgrade + to enable encrypted attributes. + + + + +
+
+{/if} + + diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/url.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/url.svelte index 4c9d6991e..2d003a21a 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/url.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/url.svelte @@ -93,5 +93,4 @@ label="Array" bind:checked={data.array} disabled={data.required || editing} - description="Indicate whether this attribute should act as an array, with the default value set as an empty - array." /> + description="Indicate whether this attribute is an array. Defaults to an empty array." /> diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/store.ts b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/store.ts index 476fccde8..3fb3c64de 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/store.ts +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/document-[document]/attributes/store.ts @@ -15,3 +15,8 @@ export function isRelationship(attribute: Attributes): attribute is Models.Attri if (!attribute) return false; return attribute?.type === 'relationship'; } + +export function isString(attribute: Attributes): attribute is Models.AttributeString { + if (!attribute) return false; + return attribute?.type === 'string'; +} diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/indexes/+page.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/indexes/+page.svelte index c04b73365..f9258a35b 100644 --- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/indexes/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/indexes/+page.svelte @@ -79,13 +79,15 @@ { id: 'type' }, { id: 'attributes' }, { id: 'orders' }, + { id: 'lengths' }, { id: 'actions', width: 40 } ]}> Key Type Attributes - Asc/Desc + Orders + Lengths {#each data.collection.indexes as index} @@ -118,6 +120,9 @@ {index.orders} + + {index.lengths} + {:else if formatted.truncated} {formatted.value}