@prefecthq/prefect-ui-library 3.0.11 → 3.0.12

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.
@@ -431,14 +431,14 @@ export declare const maps: {
431
431
  VariableCreate: {
432
432
  VariableCreateRequest: import("..").MapFunction<import("..").VariableCreate, Partial<{
433
433
  name: string | null;
434
- value: unknown;
434
+ value: string | null;
435
435
  tags: string[] | null;
436
436
  }>>;
437
437
  };
438
438
  VariableEdit: {
439
439
  VariableEditRequest: import("..").MapFunction<import("..").VariableEdit, Partial<{
440
440
  name: string | null;
441
- value: unknown;
441
+ value: string | null;
442
442
  tags: string[] | null;
443
443
  }>>;
444
444
  };
@@ -3,7 +3,7 @@ export interface IVariable {
3
3
  created: Date;
4
4
  updated: Date;
5
5
  name: string;
6
- value: unknown;
6
+ value: string;
7
7
  tags: string[];
8
8
  }
9
9
  export declare const MAX_VARIABLE_NAME_LENGTH: 255;
@@ -13,7 +13,7 @@ export declare class Variable implements IVariable {
13
13
  readonly created: Date;
14
14
  readonly updated: Date;
15
15
  name: string;
16
- value: unknown;
16
+ value: string;
17
17
  tags: string[];
18
18
  constructor(variable: IVariable);
19
19
  }
@@ -1,5 +1,5 @@
1
1
  export type VariableCreate = {
2
2
  name: string;
3
- value: unknown;
3
+ value: string;
4
4
  tags?: string[];
5
5
  };
@@ -1,5 +1,5 @@
1
1
  export type VariableEdit = {
2
2
  name?: string | null;
3
- value?: unknown | null;
3
+ value?: string | null;
4
4
  tags?: string[] | null;
5
5
  };
@@ -1,10 +1,10 @@
1
1
  export type VariableCreateRequest = Partial<{
2
2
  name: string | null;
3
- value: unknown;
3
+ value: string | null;
4
4
  tags: string[] | null;
5
5
  }>;
6
6
  export type VariableEditRequest = Partial<{
7
7
  name: string | null;
8
- value: unknown;
8
+ value: string | null;
9
9
  tags: string[] | null;
10
10
  }>;
@@ -2,7 +2,7 @@ import { DateString } from '../../types';
2
2
  export type VariableResponse = {
3
3
  id: string;
4
4
  name: string;
5
- value: unknown;
5
+ value: string;
6
6
  tags: string[] | null;
7
7
  created: DateString;
8
8
  updated: DateString;
@@ -455,14 +455,14 @@ export declare const mapper: Mapper<{
455
455
  VariableCreate: {
456
456
  VariableCreateRequest: MapFunction<import("..").VariableCreate, Partial<{
457
457
  name: string | null;
458
- value: unknown;
458
+ value: string | null;
459
459
  tags: string[] | null;
460
460
  }>>;
461
461
  };
462
462
  VariableEdit: {
463
463
  VariableEditRequest: MapFunction<import("..").VariableEdit, Partial<{
464
464
  name: string | null;
465
- value: unknown;
465
+ value: string | null;
466
466
  tags: string[] | null;
467
467
  }>>;
468
468
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prefecthq/prefect-ui-library",
3
- "version": "3.0.11",
3
+ "version": "3.0.12",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,21 +1,19 @@
1
1
  <template>
2
2
  <div class="variable-link" />
3
- <p-button v-if="(value?.length ?? 0) > 64" size="sm" @click="openEditModal">
3
+ <p-button v-if="variable.value.length > 64" size="sm" @click="openEditModal">
4
4
  {{ valueOverflowText }}
5
5
  </p-button>
6
- <p-code-highlight v-else :text="value ?? ''" lang="json" inline />
6
+ <p-code-highlight v-else :text="variable.value" lang="json" inline />
7
7
  <VariableEditModal v-model:showModal="showEditModal" :variable="variable" @update="handleUpdate" />
8
8
  </template>
9
9
 
10
10
 
11
11
  <script lang="ts" setup>
12
- import { computed } from 'vue'
13
- import { stringifyUnknownJson } from '..'
14
12
  import VariableEditModal from '@/components/VariableEditModal.vue'
15
13
  import { useShowModal } from '@/compositions/useShowModal'
16
14
  import { Variable } from '@/models/Variable'
17
15
 
18
- const props = defineProps<{
16
+ defineProps<{
19
17
  variable: Variable,
20
18
  valueOverflowText?: string,
21
19
  }>()
@@ -29,9 +27,5 @@
29
27
  const handleUpdate = (variable: Variable): void => {
30
28
  emit('update', variable)
31
29
  }
32
-
33
- const value = computed(() => {
34
- return stringifyUnknownJson(props.variable.value)
35
- })
36
30
  </script>
37
31
 
@@ -29,7 +29,6 @@
29
29
  import { useValidation, useValidationObserver, ValidationRule } from '@prefecthq/vue-compositions'
30
30
  import { isNull } from 'lodash'
31
31
  import { computed, ref } from 'vue'
32
- import { stringifyUnknownJson } from '..'
33
32
  import { JsonInput } from '@/components'
34
33
  import { useWorkspaceApi } from '@/compositions'
35
34
  import { localization } from '@/localization'
@@ -37,7 +36,6 @@
37
36
  import { isSnakeCase, isRequired, isString, isLessThanOrEqual, isJson } from '@/utilities'
38
37
  import { getApiErrorMessage } from '@/utilities/errors'
39
38
 
40
-
41
39
  const props = defineProps<{
42
40
  variable: Variable,
43
41
  showModal: boolean,
@@ -92,7 +90,7 @@
92
90
 
93
91
  const { validate, pending } = useValidationObserver()
94
92
  const name = ref<string>(props.variable.name)
95
- const value = ref<string>(stringifyUnknownJson(props.variable.value ?? '') ?? '')
93
+ const value = ref<string>(props.variable.value)
96
94
  const tags = ref<string[]>(props.variable.tags)
97
95
 
98
96
  const rules: Record<string, ValidationRule<string | undefined>[]> = {
@@ -2,7 +2,7 @@
2
2
  <p-icon-button-menu v-bind="$attrs">
3
3
  <copy-overflow-menu-item :label="localization.info.copyId" :item="variable.id" />
4
4
  <copy-overflow-menu-item :label="localization.info.copyName" :item="variable.name" />
5
- <copy-overflow-menu-item :label="localization.info.copyValue" :item="value ?? ''" />
5
+ <copy-overflow-menu-item :label="localization.info.copyValue" :item="variable.value" />
6
6
  <p-overflow-menu-item v-if="can.update.variable" :label="localization.info.edit" @click="openEditModal" />
7
7
  <p-overflow-menu-item v-if="can.delete.variable" :label="localization.info.delete" @click="openDeleteModal" />
8
8
  </p-icon-button-menu>
@@ -27,15 +27,13 @@
27
27
 
28
28
  <script lang="ts" setup>
29
29
  import { showToast } from '@prefecthq/prefect-design'
30
- import { computed, ref } from 'vue'
31
- import { stringifyUnknownJson } from '..'
32
30
  import { ConfirmDeleteModal, CopyOverflowMenuItem, VariableEditModal } from '@/components'
33
31
  import { useWorkspaceApi, useCan, useShowModal } from '@/compositions'
34
32
  import { localization } from '@/localization'
35
33
  import { Variable } from '@/models'
36
34
  import { getApiErrorMessage } from '@/utilities/errors'
37
35
 
38
- const props = defineProps<{
36
+ defineProps<{
39
37
  variable: Variable,
40
38
  }>()
41
39
 
@@ -68,8 +66,4 @@
68
66
  const handleUpdate = (variable: Variable): void => {
69
67
  emit('update', variable)
70
68
  }
71
-
72
- const value = computed(() => {
73
- return stringifyUnknownJson(props.variable.value)
74
- })
75
69
  </script>
@@ -90,7 +90,7 @@
90
90
  import { useDebouncedRef, useLocalStorage, useSubscription } from '@prefecthq/vue-compositions'
91
91
  import merge from 'lodash.merge'
92
92
  import { computed, ref } from 'vue'
93
- import { VariablesDeleteButton, VariableMenu, ResultsCount, SearchInput, SelectedCount, VariableTagsInput } from '@/components'
93
+ import { VariablesDeleteButton, VariableMenu, ResultsCount, SearchInput, SelectedCount, VariableTagsInput, VariableEditModal } from '@/components'
94
94
  import VariableDisplayPreview from '@/components/VariableDisplayPreview.vue'
95
95
  import { useCan, useVariablesFilter, useWorkspaceApi } from '@/compositions'
96
96
  import { localization } from '@/localization'
@@ -3,7 +3,6 @@ import { Variable, VariableCreate, VariableEdit } from '..'
3
3
  import { VariableCreateRequest, VariableEditRequest } from '@/models/api/VariableRequest'
4
4
  import { VariableResponse } from '@/models/api/VariableResponse'
5
5
  import { MapFunction } from '@/services/Mapper'
6
- import { parseUnknownJson } from '@/utilities/parseUnknownJson'
7
6
 
8
7
  export const mapVariableResponseToVariable: MapFunction<VariableResponse, Variable> = function(source) {
9
8
  return new Variable({
@@ -19,7 +18,7 @@ export const mapVariableResponseToVariable: MapFunction<VariableResponse, Variab
19
18
  export const mapVariableEditToVariableEditRequest: MapFunction<VariableEdit, VariableEditRequest> = function(source) {
20
19
  return {
21
20
  name: source.name,
22
- value: parseUnknownJson(source.value),
21
+ value: source.value,
23
22
  tags: source.tags,
24
23
  }
25
24
  }
@@ -27,7 +26,7 @@ export const mapVariableEditToVariableEditRequest: MapFunction<VariableEdit, Var
27
26
  export const mapVariableCreateToVariableCreateRequest: MapFunction<VariableCreate, VariableCreateRequest> = function(source) {
28
27
  return {
29
28
  name: source.name,
30
- value: parseUnknownJson(source.value),
29
+ value: source.value,
31
30
  tags: source.tags,
32
31
  }
33
32
  }
@@ -1,9 +1,10 @@
1
+
1
2
  export interface IVariable {
2
3
  id: string,
3
4
  created: Date,
4
5
  updated: Date,
5
6
  name: string,
6
- value: unknown,
7
+ value: string,
7
8
  tags: string[],
8
9
  }
9
10
 
@@ -15,7 +16,7 @@ export class Variable implements IVariable {
15
16
  public readonly created: Date
16
17
  public readonly updated: Date
17
18
  public name: string
18
- public value: unknown
19
+ public value: string
19
20
  public tags: string[]
20
21
 
21
22
  public constructor(
@@ -1,5 +1,5 @@
1
1
  export type VariableCreate = {
2
2
  name: string,
3
- value: unknown,
3
+ value: string,
4
4
  tags?: string[],
5
5
  }
@@ -1,5 +1,5 @@
1
1
  export type VariableEdit = {
2
2
  name?: string | null,
3
- value?: unknown | null,
3
+ value?: string | null,
4
4
  tags?: string[] | null,
5
5
  }
@@ -1,11 +1,11 @@
1
1
  export type VariableCreateRequest = Partial<{
2
2
  name: string | null,
3
- value: unknown,
3
+ value: string | null,
4
4
  tags: string[] | null,
5
5
  }>
6
6
 
7
7
  export type VariableEditRequest = Partial<{
8
8
  name: string | null,
9
- value: unknown,
9
+ value: string | null,
10
10
  tags: string[] | null,
11
11
  }>
@@ -3,7 +3,7 @@ import { DateString } from '@/types'
3
3
  export type VariableResponse = {
4
4
  id: string,
5
5
  name: string,
6
- value: unknown,
6
+ value: string,
7
7
  tags: string[] | null,
8
8
  created: DateString,
9
9
  updated: DateString,