@platforma-sdk/ui-vue 1.82.6 → 1.83.1
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/.turbo/turbo-build.log +169 -23
- package/.turbo/turbo-formatter$colon$check.log +2 -2
- package/.turbo/turbo-linter$colon$check.log +2 -2
- package/.turbo/turbo-types$colon$check.log +2 -2
- package/CHANGELOG.md +62 -0
- package/dist/components/PlAgDataTable/PlAgDataTableV2.vue2.js +1 -1
- package/dist/components/PlAgDataTable/compositions/useFilterableColumns.d.ts +16 -16
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.js.map +1 -1
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.style.js.map +1 -1
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.vue2.js +1 -1
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.vue2.js.map +1 -1
- package/dist/components/PlAnnotations/components/FilterSidebar.js.map +1 -1
- package/dist/components/PlAnnotations/components/FilterSidebar.style.js.map +1 -1
- package/dist/components/PlAnnotations/components/FilterSidebar.vue2.js +1 -1
- package/dist/components/PlAnnotations/components/FilterSidebar.vue2.js.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotations.vue2.js.map +1 -1
- package/dist/defineApp.d.ts +2 -32
- package/dist/defineApp.d.ts.map +1 -1
- package/dist/defineApp.js +20 -62
- package/dist/defineApp.js.map +1 -1
- package/dist/index.js +39 -39
- package/dist/internal/createAppV3.d.ts +1 -1
- package/dist/internal/createAppV3.js +16 -16
- package/dist/lib/util/helpers/dist/utils.js +2 -5
- package/dist/lib/util/helpers/dist/utils.js.map +1 -1
- package/dist/lib.js +1 -1
- package/package.json +8 -8
- package/src/components/PlAnnotations/components/AnnotationsSidebar.vue +2 -2
- package/src/components/PlAnnotations/components/FilterSidebar.vue +2 -2
- package/src/defineApp.ts +1 -183
- package/dist/components/BlockLayout.vue.d.ts +0 -3
- package/dist/components/BlockLayout.vue.d.ts.map +0 -1
- package/dist/components/BlockLoader.vue.d.ts +0 -6
- package/dist/components/BlockLoader.vue.d.ts.map +0 -1
- package/dist/components/LoaderPage.vue.d.ts +0 -3
- package/dist/components/LoaderPage.vue.d.ts.map +0 -1
- package/dist/components/NotFound.vue.d.ts +0 -3
- package/dist/components/NotFound.vue.d.ts.map +0 -1
- package/dist/components/PlAdvancedFilter/FilterEditor.vue.d.ts +0 -23
- package/dist/components/PlAdvancedFilter/FilterEditor.vue.d.ts.map +0 -1
- package/dist/components/PlAdvancedFilter/OperandButton.vue.d.ts +0 -9
- package/dist/components/PlAdvancedFilter/OperandButton.vue.d.ts.map +0 -1
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.vue.d.ts +0 -55
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.vue.d.ts.map +0 -1
- package/dist/components/PlAgCellFile/PlAgCellFile.vue.d.ts +0 -26
- package/dist/components/PlAgCellFile/PlAgCellFile.vue.d.ts.map +0 -1
- package/dist/components/PlAgCellProgress/PlAgCellProgress.vue.d.ts +0 -8
- package/dist/components/PlAgCellProgress/PlAgCellProgress.vue.d.ts.map +0 -1
- package/dist/components/PlAgCellStatusTag/PlAgCellStatusTag.vue.d.ts +0 -10
- package/dist/components/PlAgCellStatusTag/PlAgCellStatusTag.vue.d.ts.map +0 -1
- package/dist/components/PlAgChartHistogramCell/PlAgChartHistogramCell.vue.d.ts +0 -11
- package/dist/components/PlAgChartHistogramCell/PlAgChartHistogramCell.vue.d.ts.map +0 -1
- package/dist/components/PlAgChartStackedBarCell/PlAgChartStackedBarCell.vue.d.ts +0 -8
- package/dist/components/PlAgChartStackedBarCell/PlAgChartStackedBarCell.vue.d.ts.map +0 -1
- package/dist/components/PlAgColumnHeader/PlAgColumnHeader.vue.d.ts +0 -10
- package/dist/components/PlAgColumnHeader/PlAgColumnHeader.vue.d.ts.map +0 -1
- package/dist/components/PlAgCsvExporter/PlAgCsvExporter.vue.d.ts +0 -10
- package/dist/components/PlAgCsvExporter/PlAgCsvExporter.vue.d.ts.map +0 -1
- package/dist/components/PlAgDataTable/PlAgDataTableSheets.vue.d.ts +0 -31
- package/dist/components/PlAgDataTable/PlAgDataTableSheets.vue.d.ts.map +0 -1
- package/dist/components/PlAgDataTable/PlAgDataTableV2.vue.d.ts +0 -94
- package/dist/components/PlAgDataTable/PlAgDataTableV2.vue.d.ts.map +0 -1
- package/dist/components/PlAgDataTable/PlAgOverlayLoading.vue.d.ts +0 -10
- package/dist/components/PlAgDataTable/PlAgOverlayLoading.vue.d.ts.map +0 -1
- package/dist/components/PlAgDataTable/PlAgOverlayNoRows.vue.d.ts +0 -9
- package/dist/components/PlAgDataTable/PlAgOverlayNoRows.vue.d.ts.map +0 -1
- package/dist/components/PlAgDataTable/PlAgRowCount.vue.d.ts +0 -9
- package/dist/components/PlAgDataTable/PlAgRowCount.vue.d.ts.map +0 -1
- package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.vue.d.ts +0 -17
- package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.vue.d.ts.map +0 -1
- package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.vue.d.ts +0 -7
- package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.vue.d.ts.map +0 -1
- package/dist/components/PlAgRowNumHeader.vue.d.ts +0 -7
- package/dist/components/PlAgRowNumHeader.vue.d.ts.map +0 -1
- package/dist/components/PlAgTextAndButtonCell/PlAgTextAndButtonCell.vue.d.ts +0 -32
- package/dist/components/PlAgTextAndButtonCell/PlAgTextAndButtonCell.vue.d.ts.map +0 -1
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.vue.d.ts +0 -14
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.vue.d.ts.map +0 -1
- package/dist/components/PlAnnotations/components/FilterSidebar.vue.d.ts +0 -26
- package/dist/components/PlAnnotations/components/FilterSidebar.vue.d.ts.map +0 -1
- package/dist/components/PlAnnotations/components/PlAnnotations.vue.d.ts +0 -10
- package/dist/components/PlAnnotations/components/PlAnnotations.vue.d.ts.map +0 -1
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.vue.d.ts +0 -8
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.vue.d.ts.map +0 -1
- package/dist/components/PlAppErrorNotificationAlert/PlAppErrorNotificationAlert.vue.d.ts +0 -11
- package/dist/components/PlAppErrorNotificationAlert/PlAppErrorNotificationAlert.vue.d.ts.map +0 -1
- package/dist/components/PlBtnExportArchive/Item.vue.d.ts +0 -7
- package/dist/components/PlBtnExportArchive/Item.vue.d.ts.map +0 -1
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.vue.d.ts +0 -35
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.vue.d.ts.map +0 -1
- package/dist/components/PlBtnExportArchive/Summary.vue.d.ts +0 -11
- package/dist/components/PlBtnExportArchive/Summary.vue.d.ts.map +0 -1
- package/dist/components/PlDatasetSelector/PlDatasetSelector.vue.d.ts +0 -77
- package/dist/components/PlDatasetSelector/PlDatasetSelector.vue.d.ts.map +0 -1
- package/dist/components/PlTableFastSearch/PlTableFastSearch.vue.d.ts +0 -10
- package/dist/components/PlTableFastSearch/PlTableFastSearch.vue.d.ts.map +0 -1
- package/dist/components/PlTableFilters/PlTableFiltersV2.vue.d.ts +0 -14
- package/dist/components/PlTableFilters/PlTableFiltersV2.vue.d.ts.map +0 -1
- package/dist/internal/createAppModel.d.ts +0 -7
- package/dist/internal/createAppModel.d.ts.map +0 -1
- package/dist/internal/createAppModel.js +0 -57
- package/dist/internal/createAppModel.js.map +0 -1
- package/dist/internal/createAppV1.d.ts +0 -53
- package/dist/internal/createAppV1.d.ts.map +0 -1
- package/dist/internal/createAppV1.js +0 -129
- package/dist/internal/createAppV1.js.map +0 -1
- package/dist/internal/createAppV2.d.ts +0 -50
- package/dist/internal/createAppV2.d.ts.map +0 -1
- package/dist/internal/createAppV2.js +0 -137
- package/dist/internal/createAppV2.js.map +0 -1
- package/dist/internal/createAppV2.test.d.ts +0 -15
- package/dist/internal/createAppV2.test.d.ts.map +0 -1
- package/dist/internal/test-helpers/BlockMock.d.ts +0 -29
- package/dist/internal/test-helpers/BlockMock.d.ts.map +0 -1
- package/dist/internal/test-helpers/createMockApi.d.ts +0 -4
- package/dist/internal/test-helpers/createMockApi.d.ts.map +0 -1
- package/dist/internal/test-helpers/utils.d.ts +0 -4
- package/dist/internal/test-helpers/utils.d.ts.map +0 -1
- package/dist/internal/v1.static-test.d.ts +0 -7
- package/dist/internal/v1.static-test.d.ts.map +0 -1
- package/dist/internal/v2.static-test.d.ts +0 -7
- package/dist/internal/v2.static-test.d.ts.map +0 -1
- package/dist/plugins/Monetization/EndOfPeriod.vue.d.ts +0 -6
- package/dist/plugins/Monetization/EndOfPeriod.vue.d.ts.map +0 -1
- package/dist/plugins/Monetization/LimitCard.vue.d.ts +0 -11
- package/dist/plugins/Monetization/LimitCard.vue.d.ts.map +0 -1
- package/dist/plugins/Monetization/MonetizationSidebar.vue.d.ts +0 -3
- package/dist/plugins/Monetization/MonetizationSidebar.vue.d.ts.map +0 -1
- package/dist/plugins/Monetization/RunStatus.vue.d.ts +0 -23
- package/dist/plugins/Monetization/RunStatus.vue.d.ts.map +0 -1
- package/dist/plugins/Monetization/UserCabinetCard.vue.d.ts +0 -7
- package/dist/plugins/Monetization/UserCabinetCard.vue.d.ts.map +0 -1
- package/src/internal/createAppModel.ts +0 -112
- package/src/internal/createAppV1.ts +0 -324
- package/src/internal/createAppV2.test.ts +0 -207
- package/src/internal/createAppV2.ts +0 -392
- package/src/internal/test-helpers/BlockMock.ts +0 -161
- package/src/internal/test-helpers/createMockApi.ts +0 -104
- package/src/internal/test-helpers/utils.ts +0 -65
- package/src/internal/v1.static-test.ts +0 -107
- package/src/internal/v2.static-test.ts +0 -107
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { deepClone, delay, uniqueId } from "@milaboratories/helpers";
|
|
2
|
-
import {
|
|
3
|
-
type BlockOutputsBase,
|
|
4
|
-
type BlockState,
|
|
5
|
-
type NavigationState,
|
|
6
|
-
type AuthorMarker,
|
|
7
|
-
type ValueWithUTagAndAuthor,
|
|
8
|
-
wrapAsyncCallback,
|
|
9
|
-
type ResultOrError,
|
|
10
|
-
unwrapResult,
|
|
11
|
-
} from "@platforma-sdk/model";
|
|
12
|
-
import { compare, type Operation } from "fast-json-patch";
|
|
13
|
-
import type { BlockApiV2, ValueWithUTag } from "@platforma-sdk/model";
|
|
14
|
-
|
|
15
|
-
export class BlockStateMock<
|
|
16
|
-
Args = unknown,
|
|
17
|
-
Outputs extends BlockOutputsBase = BlockOutputsBase,
|
|
18
|
-
UiState = unknown,
|
|
19
|
-
Href extends `/${string}` = `/${string}`,
|
|
20
|
-
> {
|
|
21
|
-
constructor(
|
|
22
|
-
public args: Args,
|
|
23
|
-
public outputs: Outputs,
|
|
24
|
-
public ui: UiState,
|
|
25
|
-
public href: Href,
|
|
26
|
-
public author: AuthorMarker = { authorId: "test", localVersion: 0 },
|
|
27
|
-
public uTag: string = uniqueId(),
|
|
28
|
-
) {}
|
|
29
|
-
|
|
30
|
-
setState(_state: Partial<BlockStateMock<Args, Outputs, UiState, Href>>) {
|
|
31
|
-
const state = deepClone(_state);
|
|
32
|
-
this.args = state.args ?? this.args;
|
|
33
|
-
this.outputs = state.outputs ?? this.outputs;
|
|
34
|
-
this.ui = state.ui ?? this.ui;
|
|
35
|
-
this.href = state.href ?? this.href;
|
|
36
|
-
this.author = state.author ?? this.author;
|
|
37
|
-
console.log("set author", state.author);
|
|
38
|
-
this.uTag = uniqueId();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export abstract class BlockMock<
|
|
43
|
-
Args = unknown,
|
|
44
|
-
Outputs extends BlockOutputsBase = BlockOutputsBase,
|
|
45
|
-
UiState = unknown,
|
|
46
|
-
Href extends `/${string}` = `/${string}`,
|
|
47
|
-
> implements BlockApiV2<Args, Outputs, UiState, Href> {
|
|
48
|
-
#previousState:
|
|
49
|
-
| {
|
|
50
|
-
uTag: string;
|
|
51
|
-
value: BlockState<Args, Outputs, UiState, Href>;
|
|
52
|
-
}
|
|
53
|
-
| undefined;
|
|
54
|
-
|
|
55
|
-
constructor(public state: BlockStateMock<Args, Outputs, UiState, Href>) {
|
|
56
|
-
this.loadBlockState()
|
|
57
|
-
.then(unwrapResult)
|
|
58
|
-
.then(({ uTag, value }) => {
|
|
59
|
-
this.#previousState = { value, uTag };
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
async dispose(): Promise<ResultOrError<void>> {
|
|
64
|
-
console.log("unused");
|
|
65
|
-
return { value: undefined };
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
get uTag(): string {
|
|
69
|
-
return this.state.uTag;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
async setBlockArgs(args: Args, author?: AuthorMarker) {
|
|
73
|
-
return wrapAsyncCallback(() => {
|
|
74
|
-
this.state.setState({ args, author });
|
|
75
|
-
return this.doUpdate();
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
async setBlockUiState(ui: UiState, author?: AuthorMarker) {
|
|
80
|
-
return wrapAsyncCallback(async () => {
|
|
81
|
-
this.state.setState({ ui, author });
|
|
82
|
-
return this.doUpdate();
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
async setBlockArgsAndUiState(args: Args, ui: UiState, author?: AuthorMarker) {
|
|
87
|
-
return wrapAsyncCallback(async () => {
|
|
88
|
-
await delay(0);
|
|
89
|
-
if (
|
|
90
|
-
typeof ui === "object" &&
|
|
91
|
-
ui !== null &&
|
|
92
|
-
"delay" in ui &&
|
|
93
|
-
ui.delay &&
|
|
94
|
-
typeof ui.delay === "number"
|
|
95
|
-
) {
|
|
96
|
-
console.log("DELAY", ui.delay);
|
|
97
|
-
await delay(ui.delay);
|
|
98
|
-
}
|
|
99
|
-
this.state.setState({ args, ui, author });
|
|
100
|
-
return this.doUpdate();
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
async setNavigationState(navigationState: NavigationState<Href>) {
|
|
105
|
-
return wrapAsyncCallback(() => {
|
|
106
|
-
this.state.setState({ href: navigationState.href });
|
|
107
|
-
return this.doUpdate();
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
async loadBlockState(): Promise<
|
|
112
|
-
ResultOrError<ValueWithUTag<BlockState<Args, Outputs, UiState, Href>>>
|
|
113
|
-
> {
|
|
114
|
-
return wrapAsyncCallback(async () => {
|
|
115
|
-
return deepClone({
|
|
116
|
-
value: {
|
|
117
|
-
args: this.state.args,
|
|
118
|
-
ui: this.state.ui,
|
|
119
|
-
outputs: this.state.outputs,
|
|
120
|
-
navigationState: {
|
|
121
|
-
href: this.state.href,
|
|
122
|
-
},
|
|
123
|
-
author: this.state.author,
|
|
124
|
-
},
|
|
125
|
-
uTag: this.state.uTag,
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
async getPatches(uTag: string): Promise<ResultOrError<ValueWithUTagAndAuthor<Operation[]>>> {
|
|
131
|
-
return wrapAsyncCallback(async () => {
|
|
132
|
-
while (uTag === this.state.uTag) {
|
|
133
|
-
await delay(0);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (this.#previousState?.uTag !== uTag) {
|
|
137
|
-
console.log("uTag mismatch, resetting previous state");
|
|
138
|
-
this.#previousState = undefined;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const currentState = await this.loadBlockState()
|
|
142
|
-
.then(unwrapResult)
|
|
143
|
-
.then(({ uTag, value }) => ({ uTag, value }));
|
|
144
|
-
const patches = compare(this.#previousState?.value ?? {}, currentState.value);
|
|
145
|
-
this.#previousState = currentState;
|
|
146
|
-
return {
|
|
147
|
-
uTag: this.state.uTag,
|
|
148
|
-
value: patches,
|
|
149
|
-
author: this.state.author,
|
|
150
|
-
};
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
private async doUpdate() {
|
|
155
|
-
await this.process();
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
abstract process(): Promise<void>;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export type InferState<B> = B extends BlockMock<infer S> ? S : never;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { delay } from "@milaboratories/helpers";
|
|
2
|
-
import type {
|
|
3
|
-
AuthorMarker,
|
|
4
|
-
BlockOutputsBase,
|
|
5
|
-
BlockState,
|
|
6
|
-
FileLike,
|
|
7
|
-
ImportFileHandle,
|
|
8
|
-
ListFilesResult,
|
|
9
|
-
LocalImportFileHandle,
|
|
10
|
-
NavigationState,
|
|
11
|
-
OpenDialogOps,
|
|
12
|
-
OpenMultipleFilesResponse,
|
|
13
|
-
OpenSingleFileResponse,
|
|
14
|
-
PlatformaV2,
|
|
15
|
-
ResultOrError,
|
|
16
|
-
StorageHandle,
|
|
17
|
-
ValueWithUTag,
|
|
18
|
-
ValueWithUTagAndAuthor,
|
|
19
|
-
} from "@platforma-sdk/model";
|
|
20
|
-
import type { Operation } from "fast-json-patch";
|
|
21
|
-
import type { BlockMock } from "./BlockMock";
|
|
22
|
-
import { getLsFilesResult } from "./utils";
|
|
23
|
-
|
|
24
|
-
export function createMockApi<
|
|
25
|
-
Args,
|
|
26
|
-
Outputs extends BlockOutputsBase,
|
|
27
|
-
UiState = unknown,
|
|
28
|
-
Href extends `/${string}` = `/${string}`,
|
|
29
|
-
>(block: BlockMock<Args, Outputs, UiState, Href>): PlatformaV2<Args, Outputs, UiState, Href> {
|
|
30
|
-
return {
|
|
31
|
-
apiVersion: 2,
|
|
32
|
-
sdkInfo: {
|
|
33
|
-
sdkVersion: "dev",
|
|
34
|
-
},
|
|
35
|
-
async dispose(): Promise<ResultOrError<void>> {
|
|
36
|
-
return block.dispose();
|
|
37
|
-
},
|
|
38
|
-
loadBlockState: async function (): Promise<
|
|
39
|
-
ResultOrError<ValueWithUTag<BlockState<Args, Outputs, UiState, Href>>>
|
|
40
|
-
> {
|
|
41
|
-
return block.loadBlockState();
|
|
42
|
-
},
|
|
43
|
-
getPatches: async function (
|
|
44
|
-
uTag: string,
|
|
45
|
-
): Promise<ResultOrError<ValueWithUTagAndAuthor<Operation[]>>> {
|
|
46
|
-
return block.getPatches(uTag);
|
|
47
|
-
},
|
|
48
|
-
async setBlockArgs(value: Args, author?: AuthorMarker): Promise<ResultOrError<void>> {
|
|
49
|
-
return block.setBlockArgs(value, author);
|
|
50
|
-
},
|
|
51
|
-
async setBlockUiState(value: UiState, author?: AuthorMarker): Promise<ResultOrError<void>> {
|
|
52
|
-
return block.setBlockUiState(value, author);
|
|
53
|
-
},
|
|
54
|
-
async setBlockArgsAndUiState(
|
|
55
|
-
args: Args,
|
|
56
|
-
uiState: UiState,
|
|
57
|
-
author?: AuthorMarker,
|
|
58
|
-
): Promise<ResultOrError<void>> {
|
|
59
|
-
return block.setBlockArgsAndUiState(args, uiState, author);
|
|
60
|
-
},
|
|
61
|
-
async setNavigationState(navigationState: NavigationState<Href>): Promise<ResultOrError<void>> {
|
|
62
|
-
return block.setNavigationState(navigationState);
|
|
63
|
-
},
|
|
64
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
65
|
-
blobDriver: undefined as any,
|
|
66
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
67
|
-
logDriver: undefined as any,
|
|
68
|
-
|
|
69
|
-
lsDriver: {
|
|
70
|
-
async getStorageList() {
|
|
71
|
-
return [
|
|
72
|
-
{
|
|
73
|
-
id: "local",
|
|
74
|
-
name: "local",
|
|
75
|
-
handle: "local://test",
|
|
76
|
-
initialFullPath: "/",
|
|
77
|
-
isInitialPathHome: false,
|
|
78
|
-
},
|
|
79
|
-
];
|
|
80
|
-
},
|
|
81
|
-
async listFiles(_storage: StorageHandle, fullPath: string): Promise<ListFilesResult> {
|
|
82
|
-
await delay(10);
|
|
83
|
-
return getLsFilesResult(fullPath);
|
|
84
|
-
},
|
|
85
|
-
async getLocalFileContent(_file: LocalImportFileHandle): Promise<Uint8Array> {
|
|
86
|
-
return Uint8Array.of(0, 1);
|
|
87
|
-
},
|
|
88
|
-
async getLocalFileSize(_file: LocalImportFileHandle): Promise<number> {
|
|
89
|
-
return 3;
|
|
90
|
-
},
|
|
91
|
-
async showOpenMultipleFilesDialog(_ops: OpenDialogOps): Promise<OpenMultipleFilesResponse> {
|
|
92
|
-
return {};
|
|
93
|
-
},
|
|
94
|
-
async showOpenSingleFileDialog(_ops: OpenDialogOps): Promise<OpenSingleFileResponse> {
|
|
95
|
-
return {};
|
|
96
|
-
},
|
|
97
|
-
async fileToImportHandle(_file: FileLike): Promise<ImportFileHandle> {
|
|
98
|
-
return "" as ImportFileHandle;
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
102
|
-
pFrameDriver: undefined as any,
|
|
103
|
-
};
|
|
104
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { randomRangeInt, range, times, toList } from "@milaboratories/helpers";
|
|
2
|
-
import { faker } from "@faker-js/faker";
|
|
3
|
-
import type { ImportFileHandleUpload, ListFilesResult, LsEntry } from "@platforma-sdk/model";
|
|
4
|
-
|
|
5
|
-
export const capitalizeFirstLetter = (str: string) => {
|
|
6
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const d = new Map<string, LsEntry[]>();
|
|
10
|
-
|
|
11
|
-
export const getLsFilesResult = (path: string): ListFilesResult => {
|
|
12
|
-
const length = randomRangeInt(1, 1000);
|
|
13
|
-
|
|
14
|
-
if (path.endsWith("11")) {
|
|
15
|
-
throw Error("Some error " + faker.lorem.paragraph() + faker.lorem.paragraph());
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (!d.has(path)) {
|
|
19
|
-
const dirPath = path === "/" ? "" : path;
|
|
20
|
-
|
|
21
|
-
d.set(
|
|
22
|
-
path,
|
|
23
|
-
toList(range(0, length)).map((i) => {
|
|
24
|
-
if (i < 10) {
|
|
25
|
-
let name = faker.word.noun();
|
|
26
|
-
if (Math.random() < 0.2) {
|
|
27
|
-
name = "." + name;
|
|
28
|
-
}
|
|
29
|
-
return {
|
|
30
|
-
type: "dir",
|
|
31
|
-
name,
|
|
32
|
-
fullPath: dirPath + "/" + name,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const name =
|
|
37
|
-
times(randomRangeInt(1, 40), () => {
|
|
38
|
-
if (Math.random() < 0.2) {
|
|
39
|
-
return capitalizeFirstLetter(faker.word.noun());
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return faker.word.noun();
|
|
43
|
-
}).join(" ") + faker.system.commonFileName();
|
|
44
|
-
|
|
45
|
-
const handle = `upload://upload/${encodeURIComponent(
|
|
46
|
-
JSON.stringify({
|
|
47
|
-
localPath: dirPath + "/" + name,
|
|
48
|
-
}),
|
|
49
|
-
)}` as ImportFileHandleUpload;
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
type: "file",
|
|
53
|
-
name,
|
|
54
|
-
fullPath: dirPath + "/" + name,
|
|
55
|
-
handle,
|
|
56
|
-
};
|
|
57
|
-
}),
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
parent: "/",
|
|
63
|
-
entries: d.get(path)!,
|
|
64
|
-
};
|
|
65
|
-
};
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import type { Expect, Equal } from "@milaboratories/helpers";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import type { ModelOptions, Model } from "../types";
|
|
4
|
-
import type {
|
|
5
|
-
BlockOutputsBase,
|
|
6
|
-
InferHrefType,
|
|
7
|
-
InferOutputsType,
|
|
8
|
-
OutputWithStatus,
|
|
9
|
-
Platforma,
|
|
10
|
-
} from "@platforma-sdk/model";
|
|
11
|
-
import type { BaseAppV1, createAppV1 } from "./createAppV1";
|
|
12
|
-
import { type AppV1 } from "../defineApp";
|
|
13
|
-
import { computed, type Component } from "vue";
|
|
14
|
-
|
|
15
|
-
declare function __createModel<M, V = unknown>(options: ModelOptions<M, V>): Model<M>;
|
|
16
|
-
|
|
17
|
-
declare const __args: {
|
|
18
|
-
seed: number;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const validate = z.coerce.number().int().parse;
|
|
22
|
-
|
|
23
|
-
type _number = ReturnType<typeof validate>;
|
|
24
|
-
|
|
25
|
-
const __model1 = __createModel({
|
|
26
|
-
get() {
|
|
27
|
-
return String(__args.seed);
|
|
28
|
-
},
|
|
29
|
-
validate,
|
|
30
|
-
autoSave: true,
|
|
31
|
-
onSave(_seed) {
|
|
32
|
-
//
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const __model2 = __createModel({
|
|
37
|
-
get() {
|
|
38
|
-
return __args.seed;
|
|
39
|
-
},
|
|
40
|
-
validate,
|
|
41
|
-
autoSave: true,
|
|
42
|
-
onSave(_seed) {
|
|
43
|
-
//
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
type InferArgs<Pl extends Platforma> = Pl extends Platforma<infer Args> ? Args : never;
|
|
48
|
-
type InferUiState<Pl extends Platforma> =
|
|
49
|
-
Pl extends Platforma<unknown, BlockOutputsBase, infer UiState> ? UiState : never;
|
|
50
|
-
|
|
51
|
-
export type TestApp<P extends Platforma> = ReturnType<
|
|
52
|
-
typeof createAppV1<InferArgs<P>, InferOutputsType<P>, InferUiState<P>, InferHrefType<P>>
|
|
53
|
-
>;
|
|
54
|
-
|
|
55
|
-
type _Args = {
|
|
56
|
-
x: number;
|
|
57
|
-
y: string[];
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
type _Outputs = {
|
|
61
|
-
sum: OutputWithStatus<number> & { __unwrap: true };
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
type _UiState = {
|
|
65
|
-
flag: boolean;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
type _App1 = BaseAppV1<_Args, _Outputs, _UiState, "/">;
|
|
69
|
-
type _App2 = TestApp<Platforma<_Args, _Outputs, _UiState, "/">>;
|
|
70
|
-
|
|
71
|
-
const _local = () => {
|
|
72
|
-
const counter = computed(() => 1);
|
|
73
|
-
const label = computed(() => "aaaa");
|
|
74
|
-
|
|
75
|
-
const method = () => 100;
|
|
76
|
-
|
|
77
|
-
return {
|
|
78
|
-
counter,
|
|
79
|
-
label,
|
|
80
|
-
method,
|
|
81
|
-
routes: {
|
|
82
|
-
"/": undefined as unknown as Component,
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
type ExtApp = AppV1<1, BlockOutputsBase, unknown, "/", ReturnType<typeof _local>>;
|
|
88
|
-
|
|
89
|
-
type _UpdateArgsParams = Parameters<Parameters<_App1["updateArgs"]>[0]>[0];
|
|
90
|
-
|
|
91
|
-
type __cases = [
|
|
92
|
-
Expect<Equal<Model<string>, typeof __model1>>,
|
|
93
|
-
Expect<Equal<Model<number>, typeof __model2>>,
|
|
94
|
-
Expect<Equal<Model<string>, typeof __model1>>,
|
|
95
|
-
Expect<Equal<Model<number>, typeof __model2>>,
|
|
96
|
-
Expect<Equal<_App1, _App2>>,
|
|
97
|
-
Expect<Equal<ExtApp["counter"], number>>,
|
|
98
|
-
Expect<Equal<ExtApp["label"], string>>,
|
|
99
|
-
Expect<Equal<ExtApp["method"], () => number>>,
|
|
100
|
-
Expect<Equal<_App1["snapshot"]["args"], Readonly<_Args>>>,
|
|
101
|
-
Expect<Equal<_App1["model"]["outputs"]["sum"], number | undefined>>,
|
|
102
|
-
Expect<Equal<_App1["model"]["outputErrors"]["sum"], Error | undefined>>,
|
|
103
|
-
Expect<Equal<_App1["snapshot"]["ui"], Readonly<_UiState>>>,
|
|
104
|
-
Expect<Equal<_App1["model"]["args"], _Args>>,
|
|
105
|
-
Expect<Equal<_App1["model"]["ui"], _UiState>>,
|
|
106
|
-
Expect<Equal<_UpdateArgsParams, _Args>>,
|
|
107
|
-
];
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import type { Expect, Equal } from "@milaboratories/helpers";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import type { ModelOptions, Model } from "../types";
|
|
4
|
-
import type {
|
|
5
|
-
BlockOutputsBase,
|
|
6
|
-
InferHrefType,
|
|
7
|
-
InferOutputsType,
|
|
8
|
-
OutputWithStatus,
|
|
9
|
-
Platforma,
|
|
10
|
-
} from "@platforma-sdk/model";
|
|
11
|
-
import type { BaseAppV2, createAppV2 } from "./createAppV2";
|
|
12
|
-
import { type AppV2 } from "../defineApp";
|
|
13
|
-
import { computed, type Component } from "vue";
|
|
14
|
-
|
|
15
|
-
declare function __createModel<M, V = unknown>(options: ModelOptions<M, V>): Model<M>;
|
|
16
|
-
|
|
17
|
-
declare const __args: {
|
|
18
|
-
seed: number;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const validate = z.coerce.number().int().parse;
|
|
22
|
-
|
|
23
|
-
type _number = ReturnType<typeof validate>;
|
|
24
|
-
|
|
25
|
-
const __model1 = __createModel({
|
|
26
|
-
get() {
|
|
27
|
-
return String(__args.seed);
|
|
28
|
-
},
|
|
29
|
-
validate,
|
|
30
|
-
autoSave: true,
|
|
31
|
-
onSave(_seed) {
|
|
32
|
-
//
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const __model2 = __createModel({
|
|
37
|
-
get() {
|
|
38
|
-
return __args.seed;
|
|
39
|
-
},
|
|
40
|
-
validate,
|
|
41
|
-
autoSave: true,
|
|
42
|
-
onSave(_seed) {
|
|
43
|
-
//
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
type InferArgs<Pl extends Platforma> = Pl extends Platforma<infer Args> ? Args : never;
|
|
48
|
-
type InferUiState<Pl extends Platforma> =
|
|
49
|
-
Pl extends Platforma<unknown, BlockOutputsBase, infer UiState> ? UiState : never;
|
|
50
|
-
|
|
51
|
-
export type TestApp<P extends Platforma> = ReturnType<
|
|
52
|
-
typeof createAppV2<InferArgs<P>, InferOutputsType<P>, InferUiState<P>, InferHrefType<P>>
|
|
53
|
-
>;
|
|
54
|
-
|
|
55
|
-
type _Args = {
|
|
56
|
-
x: number;
|
|
57
|
-
y: string[];
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
type _Outputs = {
|
|
61
|
-
sum: OutputWithStatus<number> & { __unwrap: true };
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
type _UiState = {
|
|
65
|
-
flag: boolean;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
type _App1 = BaseAppV2<_Args, _Outputs, _UiState, "/">;
|
|
69
|
-
type _App2 = TestApp<Platforma<_Args, _Outputs, _UiState, "/">>;
|
|
70
|
-
|
|
71
|
-
const _local = () => {
|
|
72
|
-
const counter = computed(() => 1);
|
|
73
|
-
const label = computed(() => "aaaa");
|
|
74
|
-
|
|
75
|
-
const method = () => 100;
|
|
76
|
-
|
|
77
|
-
return {
|
|
78
|
-
counter,
|
|
79
|
-
label,
|
|
80
|
-
method,
|
|
81
|
-
routes: {
|
|
82
|
-
"/": undefined as unknown as Component,
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
type ExtApp = AppV2<1, BlockOutputsBase, unknown, "/", ReturnType<typeof _local>>;
|
|
88
|
-
|
|
89
|
-
type _UpdateArgsParams = Parameters<Parameters<_App1["updateArgs"]>[0]>[0];
|
|
90
|
-
|
|
91
|
-
type __cases = [
|
|
92
|
-
Expect<Equal<Model<string>, typeof __model1>>,
|
|
93
|
-
Expect<Equal<Model<number>, typeof __model2>>,
|
|
94
|
-
Expect<Equal<Model<string>, typeof __model1>>,
|
|
95
|
-
Expect<Equal<Model<number>, typeof __model2>>,
|
|
96
|
-
Expect<Equal<_App1, _App2>>,
|
|
97
|
-
Expect<Equal<ExtApp["counter"], number>>,
|
|
98
|
-
Expect<Equal<ExtApp["label"], string>>,
|
|
99
|
-
Expect<Equal<ExtApp["method"], () => number>>,
|
|
100
|
-
Expect<Equal<_App1["snapshot"]["args"], _Args>>,
|
|
101
|
-
Expect<Equal<_App1["model"]["outputs"]["sum"], number | undefined>>,
|
|
102
|
-
Expect<Equal<_App1["model"]["outputErrors"]["sum"], Error | undefined>>,
|
|
103
|
-
Expect<Equal<_App1["snapshot"]["ui"], _UiState>>,
|
|
104
|
-
Expect<Equal<_App1["model"]["args"], _Args>>,
|
|
105
|
-
Expect<Equal<_App1["model"]["ui"], _UiState>>,
|
|
106
|
-
Expect<Equal<_UpdateArgsParams, _Args>>,
|
|
107
|
-
];
|