@platforma-sdk/ui-vue 1.27.8 → 1.27.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-sdk/ui-vue",
3
- "version": "1.27.8",
3
+ "version": "1.27.11",
4
4
  "type": "module",
5
5
  "main": "dist/lib.umd.cjs",
6
6
  "module": "dist/lib.js",
@@ -23,8 +23,8 @@
23
23
  "canonicalize": "~2.1.0",
24
24
  "ag-grid-enterprise": "^33.0.4",
25
25
  "ag-grid-vue3": "^33.0.4",
26
- "@milaboratories/uikit": "^2.2.61",
27
- "@platforma-sdk/model": "^1.27.8"
26
+ "@milaboratories/uikit": "^2.2.63",
27
+ "@platforma-sdk/model": "^1.27.10"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@faker-js/faker": "^9.2.0",
@@ -6,6 +6,8 @@ import './pl-app-error-notification-alert.scss';
6
6
  import { PlBtnPrimary, PlDialogModal, PlNotificationAlert, PlSpacer, PlLogView } from '@milaboratories/uikit';
7
7
  import { computed, ref, watch } from 'vue';
8
8
 
9
+ export type FullMessage = { fullMessage: string; }
10
+
9
11
  const props = defineProps<{ errors: OutputErrors<BlockOutputsBase> }>();
10
12
 
11
13
  const isModalOpen = ref(false);
@@ -34,8 +36,9 @@ watch(
34
36
  <div class="pl-app-notification-alert__content">
35
37
  <template v-for="item in existingErrors" :key="item[0]">
36
38
  <div class="pl-app-notification-alert__item">
37
- <div class="pl-app-notification-alert__title">{{ item[0] }}</div>
38
- <PlLogView :value="item[1]?.message" />
39
+ <div class="pl-app-notification-alert__title">Block output: {{ item[0] }}</div>
40
+ <PlLogView :value="item[1]?.message"
41
+ :valueToCopy="'fullMessage' in (item[1] ?? {}) ? (item[1] as unknown as FullMessage).fullMessage : item[1]?.message" />
39
42
  </div>
40
43
  </template>
41
44
  </div>
@@ -2,6 +2,7 @@ import type { ComputedRef } from 'vue';
2
2
  import { computed, type ComputedGetter } from 'vue';
3
3
  import type { OptionalResult } from './types';
4
4
  import { wrapOptionalResult } from './utils';
5
+ import { ensureErrorLike } from '@platforma-sdk/model';
5
6
 
6
7
  /**
7
8
  * Creates a computed reference that wraps the result of a getter function in an `OptionalResult` object.
@@ -39,7 +40,7 @@ export function computedResult<V>(getter: ComputedGetter<V>): ComputedRef<Option
39
40
  return wrapOptionalResult(getter());
40
41
  } catch (err) {
41
42
  return {
42
- errors: [String(err)],
43
+ errors: [ensureErrorLike(err)],
43
44
  value: undefined,
44
45
  };
45
46
  }
package/src/defineApp.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { notEmpty } from '@milaboratories/helpers';
2
- import { type BlockOutputsBase, type Platforma } from '@platforma-sdk/model';
2
+ import { getPlatformaOrDefault, type BlockOutputsBase, type Platforma } from '@platforma-sdk/model';
3
3
  import type { Component, Reactive } from 'vue';
4
4
  import { inject, markRaw, reactive } from 'vue';
5
5
  import { createApp, type BaseApp } from './internal/createApp';
@@ -28,7 +28,7 @@ export function defineApp<
28
28
  activateAgGrid();
29
29
 
30
30
  const loadApp = () => {
31
- platforma
31
+ getPlatformaOrDefault<Args, Outputs, UiState, Href>(platforma)
32
32
  .loadBlockState()
33
33
  .then((state) => {
34
34
  plugin.loaded = true;
package/src/types.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Equal, Expect } from '@milaboratories/helpers';
2
- import type { BlockOutputsBase, ValueOrErrors } from '@platforma-sdk/model';
2
+ import type { BlockOutputsBase, ErrorLike, ValueOrErrors } from '@platforma-sdk/model';
3
3
  import type { Component, ComputedGetter } from 'vue';
4
4
 
5
5
  export type UnwrapValueOrErrors<R extends ValueOrErrors<unknown>> = Extract<R, { ok: true }>['value'];
@@ -140,7 +140,7 @@ export type OptionalResult<T> =
140
140
  }
141
141
  | {
142
142
  value?: undefined;
143
- errors: string[];
143
+ errors: ErrorLike[];
144
144
  };
145
145
 
146
146
  // Static tests
package/src/utils.ts CHANGED
@@ -1,20 +1,37 @@
1
- import type { ValueOrErrors } from '@platforma-sdk/model';
1
+ import { type ErrorLike, parseErrorLikeSafe, type ValueOrErrors } from '@platforma-sdk/model';
2
2
  import type { OptionalResult } from './types';
3
3
  import type { ZodError } from 'zod';
4
-
5
4
  export class UnresolvedError extends Error {}
6
5
 
7
6
  // @TODO use AggregateError
8
7
  export class MultiError extends Error {
9
- constructor(public readonly errors: string[]) {
10
- super(errors.join('\n'));
8
+ public readonly fullMessage: string;
9
+
10
+ constructor(public readonly errors: (ErrorLike | string)[]) {
11
+ super(errors.map((e) => typeof e == 'string' ? e : e.message).join('\n'));
12
+ this.fullMessage = errors.map((e) => {
13
+ if (typeof e == 'string') {
14
+ return e;
15
+ } else if (e.type == 'PlError' && 'fullMessage' in e) {
16
+ return e.fullMessage;
17
+ }
18
+ return e.message;
19
+ }).join('\n');
11
20
  }
12
21
 
13
- toString() {
14
- return this.errors.join('\n');
15
- }
22
+ // toString() {
23
+ // return this.errors.map(getErrorMessage).join('\n');
24
+ // }
16
25
  }
17
26
 
27
+ // function getErrorMessage(e: ErrorLike | string) {
28
+ // if (typeof e === 'string') {
29
+ // const errorLike = parseErrorLikeSafe(e);
30
+ // return errorLike.success ? errorLike.data.message : e;
31
+ // }
32
+ // return e.message;
33
+ // }
34
+
18
35
  export function wrapValueOrErrors<V>(value: V): ValueOrErrors<V> {
19
36
  return {
20
37
  ok: true,