@mono-lit/utility 0.0.0-stage → 0.0.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/LICENSE.md +54 -0
- package/README.md +156 -2
- package/dist/app-roots-BJsIxzjk.d.ts +91 -0
- package/dist/app-roots-CvJnmXcs.js +128 -0
- package/dist/config-node-UzJrXg0Z.js +76 -0
- package/dist/config-node.d.ts +977 -0
- package/dist/config-node.js +7 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.js +3 -0
- package/dist/create-config-D3m6xTaQ.d.ts +733 -0
- package/dist/create-config-DdL3Fh6T.js +357 -0
- package/dist/fetching.d.ts +239 -0
- package/dist/fetching.js +867 -0
- package/dist/generate-CJ7MtcDd.js +291 -0
- package/dist/index-C2hZeNkq.d.ts +365 -0
- package/dist/index-ClrZbU7n.d.ts +518 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +939 -0
- package/dist/merge-file-C5nzi_MY.d.ts +122 -0
- package/dist/merge-file-CtyKTu5L.js +133 -0
- package/dist/mock-db-5mJTObSC.js +1282 -0
- package/dist/mock-db.d.ts +2 -0
- package/dist/mock-db.js +4 -0
- package/dist/mono-alias-DNDm-jB_.js +508 -0
- package/dist/mono-clone.mjs +958 -0
- package/dist/mono-db.d.ts +1 -0
- package/dist/mono-db.js +151 -0
- package/dist/mono-env.mjs +231 -0
- package/dist/mono-git.mjs +798 -0
- package/dist/mono-link-YlOQ2PVS.js +488 -0
- package/dist/mono-prepare.d.ts +1 -0
- package/dist/mono-prepare.js +27 -0
- package/dist/mono-skills.d.ts +1 -0
- package/dist/mono-skills.js +830 -0
- package/dist/mono-tsconfig-D2qRL9_R.js +204 -0
- package/dist/mono.mjs +34 -0
- package/dist/nuxt-layers-DP1m7f1-.js +176 -0
- package/dist/nuxt-layers.d.ts +34 -0
- package/dist/nuxt-layers.js +3 -0
- package/dist/nuxt-runtime.d.ts +18 -0
- package/dist/nuxt-runtime.js +102 -0
- package/dist/nuxt.d.ts +386 -0
- package/dist/nuxt.js +590 -0
- package/dist/runtime-C_IWNrAG.js +5817 -0
- package/dist/runtime.d.ts +2583 -0
- package/dist/runtime.js +4 -0
- package/dist/session-Bk985AIM.js +1721 -0
- package/dist/types-B6FdB7LJ.d.ts +57 -0
- package/dist/universal-B2eD9xho.d.ts +97 -0
- package/dist/universal-BNTo_83u.js +599 -0
- package/dist/virtual-mono-apps.d.ts +16 -0
- package/dist/vite.d.ts +940 -0
- package/dist/vite.js +1132 -0
- package/package.json +141 -3
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
import { a as MonoFetchCookieOptions } from "./types-B6FdB7LJ.js";
|
|
2
|
+
import { NotivueItem, PushOptions } from "notivue";
|
|
3
|
+
import { RouteLocationNormalizedLoadedGeneric, Router } from "vue-router";
|
|
4
|
+
import DataSource, { DataSourceOptions } from "devextreme/data/data_source";
|
|
5
|
+
import CustomStore, { CustomStoreOptions } from "devextreme/data/custom_store";
|
|
6
|
+
import { FetchRequestConfig } from "@odata2ts/http-client-fetch";
|
|
7
|
+
import ODataStore, { ODataStoreOptions } from "devextreme/data/odata/store";
|
|
8
|
+
import { DxColumn, DxDataGrid, DxDataGridTypes } from "devextreme-vue/data-grid";
|
|
9
|
+
import { ObjectSchema } from "yup";
|
|
10
|
+
import { QBooleanPath, QDateTimeOffsetPath, QEntityCollectionPath, QEntityPath, QNumberPath, QStringPath } from "@odata2ts/odata-query-objects";
|
|
11
|
+
import { LoadOptions } from "devextreme/data";
|
|
12
|
+
|
|
13
|
+
//#region src/core/composables/use-static-datasource.d.ts
|
|
14
|
+
type AnyObj = Record<string, any>;
|
|
15
|
+
type DxFilter = [string, '=' | '<>' | '>' | '>=' | '<' | '<=' | 'contains' | 'notcontains' | 'startswith' | 'endswith', any] | ['!', DxFilter] | [DxFilter, 'and' | 'or', DxFilter] | any[];
|
|
16
|
+
type OdataParams = {
|
|
17
|
+
$filter?: string | DxFilter;
|
|
18
|
+
$orderby?: string;
|
|
19
|
+
$select?: string | string[];
|
|
20
|
+
$skip?: number;
|
|
21
|
+
$top?: number;
|
|
22
|
+
$search?: string;
|
|
23
|
+
};
|
|
24
|
+
type UseOdataStaticOpts<T extends AnyObj> = {
|
|
25
|
+
data: T[] | (() => T[]);
|
|
26
|
+
key?: keyof T | string;
|
|
27
|
+
params?: OdataParams;
|
|
28
|
+
searchFields?: (keyof T | string)[];
|
|
29
|
+
caseInsensitive?: boolean;
|
|
30
|
+
keepKeyOnSelect?: boolean;
|
|
31
|
+
source: {
|
|
32
|
+
DataSource: typeof DataSource;
|
|
33
|
+
CustomStore: typeof CustomStore;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
type Result<T> = {
|
|
37
|
+
dataSource: DataSource<T>;
|
|
38
|
+
data: T[] | null;
|
|
39
|
+
statusCode: number;
|
|
40
|
+
error: null | {
|
|
41
|
+
message: string;
|
|
42
|
+
stack: string;
|
|
43
|
+
response: any;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
declare function createStaticDatasource<T extends AnyObj>(opts: UseOdataStaticOpts<T>): Promise<Result<T>>;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/core/types/notif-action.d.ts
|
|
49
|
+
/** Relaxed button descriptor — no Vuetify dependency. */
|
|
50
|
+
interface MonoNotifButton {
|
|
51
|
+
text?: string;
|
|
52
|
+
label?: string;
|
|
53
|
+
to?: string | Record<string, any>;
|
|
54
|
+
color?: string;
|
|
55
|
+
variant?: string;
|
|
56
|
+
class?: string;
|
|
57
|
+
disabled?: boolean;
|
|
58
|
+
[key: string]: any;
|
|
59
|
+
}
|
|
60
|
+
/** `item` prop type for MonoNotifAction (self-contained). */
|
|
61
|
+
type MonoNotifActionTypes = NotivueItem & {
|
|
62
|
+
props: NotifProps['props'];
|
|
63
|
+
};
|
|
64
|
+
interface MonoNotifActionProps {
|
|
65
|
+
item: MonoNotifActionTypes;
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/core/types/notif.d.ts
|
|
69
|
+
type NotifProps = {
|
|
70
|
+
route?: RouteLocationNormalizedLoadedGeneric;
|
|
71
|
+
router?: Router;
|
|
72
|
+
message: string;
|
|
73
|
+
type: "info" | 'promise' | "warning" | "error" | "success";
|
|
74
|
+
} & Omit<PushOptions, 'message'> & {
|
|
75
|
+
props?: {
|
|
76
|
+
[key: string]: any;
|
|
77
|
+
redirect?: string;
|
|
78
|
+
isAction?: boolean;
|
|
79
|
+
isNewMessageRequest?: boolean;
|
|
80
|
+
buttons?: MonoNotifButton[];
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/core/composables/use-helper.d.ts
|
|
85
|
+
declare const useHelper: () => {
|
|
86
|
+
isDate: (value: unknown) => value is Date;
|
|
87
|
+
isJSONString: ({
|
|
88
|
+
input,
|
|
89
|
+
strict,
|
|
90
|
+
root
|
|
91
|
+
}: {
|
|
92
|
+
input: unknown;
|
|
93
|
+
strict?: boolean;
|
|
94
|
+
root?: ("object" | "any" | "array" | "primitive") | ReadonlyArray<"object" | "any" | "array" | "primitive">;
|
|
95
|
+
}) => boolean;
|
|
96
|
+
safeJSONParse: (str: string) => any;
|
|
97
|
+
replacerData: <ComT>({
|
|
98
|
+
fn,
|
|
99
|
+
type,
|
|
100
|
+
item,
|
|
101
|
+
key,
|
|
102
|
+
items
|
|
103
|
+
}: {
|
|
104
|
+
fn: "push" | "remove" | "replace";
|
|
105
|
+
type: "data";
|
|
106
|
+
item: ComT;
|
|
107
|
+
key?: (keyof ComT & (string | number)) | undefined;
|
|
108
|
+
items: MaybeRef<ComT_1[]> | {
|
|
109
|
+
key: string;
|
|
110
|
+
var: any;
|
|
111
|
+
};
|
|
112
|
+
} | {
|
|
113
|
+
fn: "push" | "remove" | "replace";
|
|
114
|
+
type: "datasource";
|
|
115
|
+
item: ComT;
|
|
116
|
+
key?: (keyof ComT & (string | number)) | undefined;
|
|
117
|
+
items: MaybeRef<DataSource<ComT_1, any> | null> | {
|
|
118
|
+
key: string;
|
|
119
|
+
var: any;
|
|
120
|
+
};
|
|
121
|
+
}) => void;
|
|
122
|
+
filterOrIn: (field: string, values: any[], combine?: boolean) => any;
|
|
123
|
+
validateAllSchema: <T extends object = any>({
|
|
124
|
+
schema,
|
|
125
|
+
input,
|
|
126
|
+
error
|
|
127
|
+
}: ValidateSchema<T>, callback?: () => void) => Promise<boolean>;
|
|
128
|
+
validateSchema: <T = any>({
|
|
129
|
+
schema,
|
|
130
|
+
field,
|
|
131
|
+
input,
|
|
132
|
+
error
|
|
133
|
+
}: ValidateSchema<T>, callback?: Function) => Promise<boolean>;
|
|
134
|
+
validateAllSchemaCheck: (error: ValidateError<any>) => boolean;
|
|
135
|
+
clearSchemaValidation: ({
|
|
136
|
+
error
|
|
137
|
+
}: {
|
|
138
|
+
error: Ref<any>;
|
|
139
|
+
}) => void;
|
|
140
|
+
notif: (options: NotifProps) => Promise<import("notivue").NotificationClearMethods | undefined>;
|
|
141
|
+
dxFilterToString: ({
|
|
142
|
+
filter,
|
|
143
|
+
encode
|
|
144
|
+
}: {
|
|
145
|
+
/** encode only the filter value (URL-safe), default false */encode?: boolean;
|
|
146
|
+
filter: string | number | boolean | Date | (string | number | boolean | Date | (string | number | boolean | Date | (string | number | boolean | Date | (string | number | boolean | Date | (string | number | boolean | Date | (string | number | boolean | Date | (string | number | boolean | Date | (string | number | boolean | Date | (string | number | boolean | Date | (string | number | boolean | Date | (string | number | boolean | Date | /*elided*/any | [string, string, any] | null | undefined)[] | [string, string, any] | null | undefined)[] | [string, string, any] | null | undefined)[] | [string, string, any] | null | undefined)[] | [string, string, any] | null | undefined)[] | [string, string, any] | null | undefined)[] | [string, string, any] | null | undefined)[] | [string, string, any] | null | undefined)[] | [string, string, any] | null | undefined)[] | [string, string, any] | null | undefined)[] | [string, string, any] | null | undefined)[] | [string, string, any] | null | undefined;
|
|
147
|
+
}) => string;
|
|
148
|
+
};
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/core/types/fetch.d.ts
|
|
151
|
+
interface FetchParam {
|
|
152
|
+
method: string;
|
|
153
|
+
url: string;
|
|
154
|
+
params?: Object;
|
|
155
|
+
body?: Object;
|
|
156
|
+
}
|
|
157
|
+
type FetchLoading<T extends string> = Record<T, boolean>;
|
|
158
|
+
// export type DataSourceOptions = DataSourceOptions
|
|
159
|
+
// type CustomQueryParams = {
|
|
160
|
+
// [key: string]: any;
|
|
161
|
+
// };
|
|
162
|
+
// type Expand = string | string[];
|
|
163
|
+
// type FilterExpression =
|
|
164
|
+
// | [string, string, any]
|
|
165
|
+
// | [string, string, any][]
|
|
166
|
+
// | [string, [string, string, any]]
|
|
167
|
+
// | [string, [string, string, any]][]
|
|
168
|
+
// | [string, [string, [string, string, any]]]
|
|
169
|
+
// | [string, [string, [string, string, any]]][]
|
|
170
|
+
// | [string, [string, [string, [string, string, any]]]]
|
|
171
|
+
// | [string, [string, [string, [string, string, any]]]][]
|
|
172
|
+
// | ['!', [string, string, any]]
|
|
173
|
+
// | [FilterExpression, 'and', FilterExpression]
|
|
174
|
+
// | [FilterExpression, 'or', FilterExpression];
|
|
175
|
+
// type GroupExpression =
|
|
176
|
+
// | string
|
|
177
|
+
// | { selector: string; desc?: boolean }
|
|
178
|
+
// | Array<string | { selector: string; desc?: boolean }>
|
|
179
|
+
// | ((item: any) => any);
|
|
180
|
+
// type LangParams = {
|
|
181
|
+
// locale: string;
|
|
182
|
+
// collatorOptions: {
|
|
183
|
+
// sensitivity: 'base' | 'accent' | 'case' | 'variant';
|
|
184
|
+
// caseFirst?: 'upper' | 'lower' | 'false';
|
|
185
|
+
// };
|
|
186
|
+
// };
|
|
187
|
+
// export type DataSourceOptions = {
|
|
188
|
+
// key: string,
|
|
189
|
+
// store?: any;
|
|
190
|
+
// customQueryParams?: CustomQueryParams;
|
|
191
|
+
// expand?: Expand;
|
|
192
|
+
// filter?: any[];
|
|
193
|
+
// group?: GroupExpression;
|
|
194
|
+
// langParams?: LangParams;
|
|
195
|
+
// map?: (dataItem: any) => any;
|
|
196
|
+
// onChanged?: (e?: { changes: Array<any> }) => void;
|
|
197
|
+
// onLoadError?: (error: { message: string }) => void;
|
|
198
|
+
// onLoadingChanged?: (isLoading: boolean) => void;
|
|
199
|
+
// pageSize?: number;
|
|
200
|
+
// paginate?: boolean;
|
|
201
|
+
// postProcess?: (data: Array<any>) => Array<any>;
|
|
202
|
+
// pushAggregationTimeout?: number;
|
|
203
|
+
// requireTotalCount?: boolean;
|
|
204
|
+
// reshapeOnPush?: boolean;
|
|
205
|
+
// searchExpr?: string | ((data: any) => any) | Array<string | ((data: any) => any)>;
|
|
206
|
+
// searchOperation?: string;
|
|
207
|
+
// searchValue?: any;
|
|
208
|
+
// select?: string | Array<string> | ((data: any) => any);
|
|
209
|
+
// sort?: string | { selector: string; desc?: boolean, asc?: boolean } | Array<string | { selector: string; desc?: boolean, asc?: boolean }> | ((data: any) => any);
|
|
210
|
+
// };
|
|
211
|
+
type NotifHelper = ReturnType<typeof useHelper>['notif'];
|
|
212
|
+
interface FetchOData<T = any> {
|
|
213
|
+
source: {
|
|
214
|
+
DataSource: typeof DataSource;
|
|
215
|
+
ODataStore: typeof ODataStore;
|
|
216
|
+
CustomStore: typeof CustomStore;
|
|
217
|
+
OdataService?: new (...args: any[]) => any;
|
|
218
|
+
};
|
|
219
|
+
force?: boolean;
|
|
220
|
+
notif?: boolean | NotifHelper;
|
|
221
|
+
baseUrl?: string;
|
|
222
|
+
token?: string;
|
|
223
|
+
url: string;
|
|
224
|
+
override?: {
|
|
225
|
+
dataSource?: ODataStoreOptions;
|
|
226
|
+
fakeDataSource?: CustomStoreOptions;
|
|
227
|
+
};
|
|
228
|
+
options?: {
|
|
229
|
+
key: string;
|
|
230
|
+
} & DataSourceOptions<T>;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Opt-in TanStack Query behaviour for a fetch. Honoured only when the installed data layer supports
|
|
234
|
+
* it — store classes flagged with `Symbol.for('mono.tanstack')` (OData fetches) or a `tanstackRun`
|
|
235
|
+
* export (REST fetches); with plain DevExtreme it is ignored and the fetch behaves as before.
|
|
236
|
+
*/
|
|
237
|
+
interface TanstackFetchOptions {
|
|
238
|
+
/** ms a cached read stays fresh (`'static'` = never stale). Setting it enables sharing. */
|
|
239
|
+
staleTime?: number | 'static';
|
|
240
|
+
/** ms an unused cached read is kept. */
|
|
241
|
+
gcTime?: number;
|
|
242
|
+
/** Share identical in-flight reads even without caching. */
|
|
243
|
+
dedupe?: boolean;
|
|
244
|
+
/** Retry failed reads (network errors, 408, 429, 5xx only): `true`, a count, or a predicate. */
|
|
245
|
+
retry?: boolean | number | ((failureCount: number, error: any) => boolean);
|
|
246
|
+
/** ms between retries, or `(attempt, error) => ms`; default exponential backoff. */
|
|
247
|
+
retryDelay?: number | ((attempt: number, error: any) => number);
|
|
248
|
+
/** `'online'` / `'offlineFirst'` pause requests while offline and resume on reconnect. */
|
|
249
|
+
networkMode?: 'online' | 'always' | 'offlineFirst';
|
|
250
|
+
/** Keep reads across page reloads (IndexedDB by default). Results must be JSON-safe. */
|
|
251
|
+
persist?: boolean | {
|
|
252
|
+
/** ms a persisted read is kept (default 24 h). */maxAge?: number; /** Entries persisted under another buster are discarded — use the user id / app version. */
|
|
253
|
+
buster?: string;
|
|
254
|
+
storage?: 'indexeddb' | 'local';
|
|
255
|
+
};
|
|
256
|
+
/** Collect the store's `byKey` calls made within `wait` ms into one filtered request. */
|
|
257
|
+
batchByKey?: boolean | {
|
|
258
|
+
wait?: number;
|
|
259
|
+
maxSize?: number;
|
|
260
|
+
};
|
|
261
|
+
/** Broadcast writes to other tabs so they drop (and can refetch) this endpoint's data. */
|
|
262
|
+
syncTabs?: boolean;
|
|
263
|
+
/** A stable cache name (custom stores); stores with the same scope share cached reads. */
|
|
264
|
+
scope?: string;
|
|
265
|
+
}
|
|
266
|
+
type NormalFetchOptions = RequestInit & {
|
|
267
|
+
notif?: boolean | NotifHelper;
|
|
268
|
+
token?: string;
|
|
269
|
+
baseUrl?: string;
|
|
270
|
+
unauthCall?: () => void;
|
|
271
|
+
expiredBehaviour?: 'refresh';
|
|
272
|
+
tokenOptions?: MonoFetchCookieOptions;
|
|
273
|
+
};
|
|
274
|
+
type NormalFetchResult<T> = {
|
|
275
|
+
statusCode: number;
|
|
276
|
+
data: T | null;
|
|
277
|
+
message: string | null;
|
|
278
|
+
all: any;
|
|
279
|
+
};
|
|
280
|
+
type ConfigType$1 = {
|
|
281
|
+
jwtName: string;
|
|
282
|
+
jwtRefreshName: string;
|
|
283
|
+
};
|
|
284
|
+
interface OdataFetchTypes<T = any> extends FetchOData<T>, FetchRequestConfig {
|
|
285
|
+
method?: 'POST' | 'GET' | 'PUT' | 'PATCH' | 'DELETE';
|
|
286
|
+
unauthCall?: () => void;
|
|
287
|
+
expiredBehaviour?: 'refresh';
|
|
288
|
+
selfProxy?: string;
|
|
289
|
+
allowZero?: boolean;
|
|
290
|
+
cache?: boolean;
|
|
291
|
+
type?: 'data' | 'datasource' | 'fakedatasource' | 'fakedata';
|
|
292
|
+
payload?: {
|
|
293
|
+
data?: Record<string, any> | null;
|
|
294
|
+
keyValue?: any;
|
|
295
|
+
keyName: string;
|
|
296
|
+
keyType?: string;
|
|
297
|
+
useBatch?: boolean;
|
|
298
|
+
};
|
|
299
|
+
config?: ConfigType$1;
|
|
300
|
+
tokenOptions?: MonoFetchCookieOptions;
|
|
301
|
+
/** Opt-in TanStack Query behaviour for the stores this fetch builds (see TanstackFetchOptions). */
|
|
302
|
+
tanstack?: TanstackFetchOptions;
|
|
303
|
+
}
|
|
304
|
+
//#endregion
|
|
305
|
+
//#region src/core/types/column.d.ts
|
|
306
|
+
// primitives / built-ins we don't want to recurse into
|
|
307
|
+
type BuiltIn = Date | Function | RegExp | Error; // treat only plain objects (not arrays, not built-ins) as nestable
|
|
308
|
+
type IsPlainObject<T> = T extends object ? T extends BuiltIn ? false : T extends readonly any[] ? false : true : false;
|
|
309
|
+
/** "a" | "a.b" | "a.b.c" ... including top-level keys */
|
|
310
|
+
type DotKeys<T> = T extends object ? { [K in Extract<keyof T, string>]: IsPlainObject<T[K]> extends true ? K | `${K}.${DotKeys<T[K]>}` : K }[Extract<keyof T, string>] : never;
|
|
311
|
+
/** Optional: value type at a given dot-path */
|
|
312
|
+
type PathValue<T, P extends string> = P extends `${infer K}.${infer R}` ? K extends keyof T ? PathValue<T[K], R> : never : P extends keyof T ? T[P] : never;
|
|
313
|
+
// --- Your Col type using DotKeys<T> and allowing extra keys I[number] ---
|
|
314
|
+
type Col<T = any, I extends readonly string[] = []> = InstanceType<typeof DxColumn>["$props"] & {
|
|
315
|
+
dataField: [keyof T] extends [never] ? I[number] | string // when T is unknown/empty
|
|
316
|
+
: I[number] | DotKeys<T>; // typed dot-paths + extras
|
|
317
|
+
cellTemplate?: [keyof T] extends [never] ? string : `${Extract<DotKeys<T>, string>}Template` | (string & {}) | ((container: HTMLElement, options: DxDataGridTypes.ColumnCellTemplateData) => void);
|
|
318
|
+
groupCellTemplate?: [keyof T] extends [never] ? string : `${Extract<DotKeys<T>, string>}GroupTemplate`;
|
|
319
|
+
headerCellTemplate?: [keyof T] extends [never] ? string : `${Extract<DotKeys<T>, string>}HeaderTemplate`;
|
|
320
|
+
editCellTemplate?: [keyof T] extends [never] ? string : `${Extract<DotKeys<T>, string>}EditCellTemplate`;
|
|
321
|
+
columns?: Col<T, I>[];
|
|
322
|
+
};
|
|
323
|
+
interface LoopTemplate<T = {}> extends Col {
|
|
324
|
+
items: keyof T extends never ? string[] : (keyof T)[];
|
|
325
|
+
}
|
|
326
|
+
interface GroupTemplate {
|
|
327
|
+
name: string;
|
|
328
|
+
code: string;
|
|
329
|
+
}
|
|
330
|
+
//#endregion
|
|
331
|
+
//#region src/core/types/schema.d.ts
|
|
332
|
+
interface ValidateSchema<T = any> {
|
|
333
|
+
schema: any;
|
|
334
|
+
field?: keyof T;
|
|
335
|
+
input: T;
|
|
336
|
+
error: any;
|
|
337
|
+
}
|
|
338
|
+
type ValidateErrorItem = {
|
|
339
|
+
valid: boolean;
|
|
340
|
+
message: string;
|
|
341
|
+
};
|
|
342
|
+
type ValidateError<T extends string = string> = Record<T, ValidateErrorItem>;
|
|
343
|
+
type WithUndefined<T> = { [P in keyof T]: T[P] | undefined };
|
|
344
|
+
interface SchemaType<T> extends WithUndefined<T> {}
|
|
345
|
+
interface Schema<T> extends ObjectSchema<SchemaType<T>> {}
|
|
346
|
+
type AnyObject = yup.AnyObject;
|
|
347
|
+
/** Map a TS type T to the corresponding Yup schema type */
|
|
348
|
+
type SchemaFor<T> = T extends string ? yup.StringSchema<string> : T extends number ? yup.NumberSchema<number> : T extends boolean ? yup.BooleanSchema<boolean> : T extends Date ? yup.DateSchema<Date> : T extends (infer U)[] ? yup.ArraySchema<SchemaFor<U>, AnyObject, U[]> : T extends Record<string, any> ? yup.ObjectSchema<{ [K in keyof T]-?: SchemaFor<T[K]> }, AnyObject, T> : yup.Schema<T>;
|
|
349
|
+
/** Build a per-key schema shape with proper schema types */
|
|
350
|
+
type SchemaObject<T> = { [K in keyof T]-?: SchemaFor<T[K]> };
|
|
351
|
+
type ValidateErrorSingle<T> = { [K in keyof T]: T[K] extends object ? ValidateError<T[K]> : ValidateErrorItem };
|
|
352
|
+
type ValidateErrorComplex<T> = { [K in keyof T]: T[K] extends object[] ? ValidateErrorItem[] // or more complex handling
|
|
353
|
+
: T[K] extends object ? ValidateErrorComplex<T[K]> : ValidateErrorItem };
|
|
354
|
+
//#endregion
|
|
355
|
+
//#region src/core/types/devextreme.d.ts
|
|
356
|
+
type FilterExpression = "=" | "<>" | ">" | ">=" | "<" | "<=" | "startswith" | "endswith" | "contains" | "notcontains";
|
|
357
|
+
interface HeaderFilter<T> {
|
|
358
|
+
value: [keyof T, FilterExpression, string];
|
|
359
|
+
text: string;
|
|
360
|
+
}
|
|
361
|
+
interface Format {
|
|
362
|
+
type?: 'currency';
|
|
363
|
+
currency?: 'IDR';
|
|
364
|
+
precision?: number;
|
|
365
|
+
}
|
|
366
|
+
interface CustomSummary {
|
|
367
|
+
column: string;
|
|
368
|
+
summaryType: "sum" | "min" | "max" | "avg" | "count";
|
|
369
|
+
name?: string;
|
|
370
|
+
alignment?: 'right' | 'center' | 'left';
|
|
371
|
+
cssClass?: string;
|
|
372
|
+
displayFormat?: string;
|
|
373
|
+
showInColumn?: string;
|
|
374
|
+
valueFormat?: Format | string;
|
|
375
|
+
}
|
|
376
|
+
type DataGrid<T = {}> = (InstanceType<typeof DxDataGrid>['$props']) & {
|
|
377
|
+
keyExpr?: keyof T extends never ? string | string[] : keyof T | (keyof T)[];
|
|
378
|
+
};
|
|
379
|
+
//#endregion
|
|
380
|
+
//#region src/core/types/odatamap.d.ts
|
|
381
|
+
type Mutable<T> = { -readonly [P in keyof T]: T[P] };
|
|
382
|
+
type GetInstance<T> = T extends (new (...args: any) => infer I) ? I : T;
|
|
383
|
+
type UnwrapPath<T> = T extends QStringPath<infer U> ? U : T extends QNumberPath<infer U> ? U : T extends QBooleanPath<infer U> ? U : T extends QDateTimeOffsetPath<infer U> ? U : T extends QEntityCollectionPath<infer Q> ? DTO_FromQ<Q>[] : T extends QEntityPath<infer Q> ? DTO_FromQ<Q> : never;
|
|
384
|
+
type AllowedPath = QStringPath<any> | QNumberPath<any> | QBooleanPath<any> | QDateTimeOffsetPath<any> | QEntityCollectionPath<any> | QEntityPath<any>;
|
|
385
|
+
type DTO_FromQ<Q> = { [K in keyof Mutable<GetInstance<Q>> as Mutable<GetInstance<Q>>[K] extends AllowedPath ? K : never]: UnwrapPath<Mutable<GetInstance<Q>>[K]> };
|
|
386
|
+
type Ctor<T = any> = new (...args: any) => T;
|
|
387
|
+
type OdataMapTypes<Q, Overrides extends Record<string, Ctor<any> | Ctor<any>[]> = {}> = Omit<DTO_FromQ<Q>, keyof Overrides> & { [K in keyof Overrides]: Overrides[K] extends Ctor<infer _> ? DTO_FromQ<Overrides[K]> : Overrides[K] extends Array<infer U> ? DTO_FromQ<U>[] : never };
|
|
388
|
+
//#endregion
|
|
389
|
+
//#region src/core/composables/use-fetch-helper.d.ts
|
|
390
|
+
declare global {
|
|
391
|
+
interface Window {
|
|
392
|
+
helper?: any;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
type ConfigType = {
|
|
396
|
+
jwtName: string;
|
|
397
|
+
jwtRefreshName: string;
|
|
398
|
+
};
|
|
399
|
+
declare function extractErrorMessage(source: any, fallback?: string): string;
|
|
400
|
+
declare function parseDxError(err: any): {
|
|
401
|
+
status: any;
|
|
402
|
+
code: any;
|
|
403
|
+
message: string;
|
|
404
|
+
body: any;
|
|
405
|
+
err: any;
|
|
406
|
+
};
|
|
407
|
+
declare const useFetchOData: <T = any>({
|
|
408
|
+
url,
|
|
409
|
+
options,
|
|
410
|
+
source,
|
|
411
|
+
type,
|
|
412
|
+
params,
|
|
413
|
+
notif,
|
|
414
|
+
force,
|
|
415
|
+
token,
|
|
416
|
+
headers,
|
|
417
|
+
selfProxy,
|
|
418
|
+
method,
|
|
419
|
+
baseUrl,
|
|
420
|
+
override,
|
|
421
|
+
allowZero,
|
|
422
|
+
cache,
|
|
423
|
+
expiredBehaviour,
|
|
424
|
+
unauthCall,
|
|
425
|
+
payload,
|
|
426
|
+
config,
|
|
427
|
+
tokenOptions,
|
|
428
|
+
tanstack
|
|
429
|
+
}: OdataFetchTypes) => Promise<{
|
|
430
|
+
data: T | null;
|
|
431
|
+
dataSource: DataSource<T> | null;
|
|
432
|
+
statusCode: number;
|
|
433
|
+
error: {
|
|
434
|
+
message: string;
|
|
435
|
+
stack: string;
|
|
436
|
+
response: any;
|
|
437
|
+
} | null;
|
|
438
|
+
}>;
|
|
439
|
+
type FetchOverrides = Omit<Partial<OdataFetchTypes>, 'url' | 'type' | 'options'> & {
|
|
440
|
+
options?: Omit<Partial<NonNullable<OdataFetchTypes['options']>>, 'key'>;
|
|
441
|
+
};
|
|
442
|
+
declare function createFetcher<T>(base: OdataFetchTypes): {
|
|
443
|
+
response(option?: FetchOverrides): Promise<{
|
|
444
|
+
data: T | null;
|
|
445
|
+
dataSource: DataSource<T, any> | null;
|
|
446
|
+
statusCode: number;
|
|
447
|
+
error: {
|
|
448
|
+
message: string;
|
|
449
|
+
stack: string;
|
|
450
|
+
response: any;
|
|
451
|
+
} | null;
|
|
452
|
+
}>;
|
|
453
|
+
};
|
|
454
|
+
type OdataFetchUniqueTypes<T> = {
|
|
455
|
+
unique: keyof T & string;
|
|
456
|
+
} & OdataFetchTypes;
|
|
457
|
+
declare const createUniqueFetcher: <T extends any>(opt: OdataFetchUniqueTypes<T>) => Promise<{
|
|
458
|
+
data: T | null;
|
|
459
|
+
dataSource: DataSource<T, any> | null;
|
|
460
|
+
statusCode: number;
|
|
461
|
+
error: {
|
|
462
|
+
message: string;
|
|
463
|
+
stack: string;
|
|
464
|
+
response: any;
|
|
465
|
+
} | null;
|
|
466
|
+
}>;
|
|
467
|
+
declare function useNormalFetch<T>(url: string, options: NormalFetchOptions, config?: ConfigType): Promise<NormalFetchResult<T>>;
|
|
468
|
+
interface TryCatchDatasourceParams<T> {
|
|
469
|
+
tryCallback: () => Promise<T> | T;
|
|
470
|
+
catchCallback?: (error: any, parsed: ReturnType<typeof parseDxError>) => Promise<T> | T;
|
|
471
|
+
finallyCallback?: () => Promise<any> | any;
|
|
472
|
+
notif?: OdataFetchTypes['notif'];
|
|
473
|
+
}
|
|
474
|
+
declare function tryCatchDatasource<T>({
|
|
475
|
+
tryCallback,
|
|
476
|
+
catchCallback,
|
|
477
|
+
finallyCallback,
|
|
478
|
+
notif
|
|
479
|
+
}: TryCatchDatasourceParams<T>): Promise<T>;
|
|
480
|
+
type LoadChunkStoreArgs<T> = {
|
|
481
|
+
datasource: DataSource<T>;
|
|
482
|
+
options: LoadOptions<T>;
|
|
483
|
+
limit?: number;
|
|
484
|
+
maxRows?: number;
|
|
485
|
+
concurrency?: number;
|
|
486
|
+
};
|
|
487
|
+
declare function loadChuckStore<T>({
|
|
488
|
+
datasource,
|
|
489
|
+
options,
|
|
490
|
+
limit,
|
|
491
|
+
maxRows,
|
|
492
|
+
concurrency
|
|
493
|
+
}: LoadChunkStoreArgs<T>): Promise<T[]>;
|
|
494
|
+
type AwaitedMap<T extends Record<string, Promise<any>>> = { [K in keyof T]: Awaited<T[K]> };
|
|
495
|
+
type SettledMap<T extends Record<string, Promise<any>>> = {
|
|
496
|
+
values: Partial<AwaitedMap<T>>;
|
|
497
|
+
errors: Partial<Record<keyof T, unknown>>;
|
|
498
|
+
};
|
|
499
|
+
type AllMap<T extends Record<string, Promise<any>>> = {
|
|
500
|
+
values: AwaitedMap<T>;
|
|
501
|
+
errors: {};
|
|
502
|
+
};
|
|
503
|
+
declare function promiseWrapper<T extends Record<string, Promise<any>>, Mode extends 'all' | 'allSettled' = 'allSettled'>({
|
|
504
|
+
task,
|
|
505
|
+
type
|
|
506
|
+
}: {
|
|
507
|
+
task: T;
|
|
508
|
+
type?: Mode;
|
|
509
|
+
}): Promise<Mode extends 'all' ? AllMap<T> : SettledMap<T>>;
|
|
510
|
+
//#endregion
|
|
511
|
+
//#region src/core/components/Notif.vue.d.ts
|
|
512
|
+
type __VLS_Props = {
|
|
513
|
+
item: MonoNotifActionTypes;
|
|
514
|
+
};
|
|
515
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
516
|
+
declare const _default: typeof __VLS_export;
|
|
517
|
+
//#endregion
|
|
518
|
+
export { GroupTemplate as A, useHelper as B, SchemaType as C, ValidateErrorSingle as D, ValidateErrorItem as E, FetchParam as F, UseOdataStaticOpts as G, MonoNotifActionProps as H, NormalFetchOptions as I, createStaticDatasource as K, NormalFetchResult as L, PathValue as M, FetchLoading as N, ValidateSchema as O, FetchOData as P, OdataFetchTypes as R, SchemaObject as S, ValidateErrorComplex as T, MonoNotifActionTypes as U, NotifProps as V, MonoNotifButton as W, DataGrid as _, TryCatchDatasourceParams as a, HeaderFilter as b, extractErrorMessage as c, promiseWrapper as d, tryCatchDatasource as f, CustomSummary as g, OdataMapTypes as h, OdataFetchUniqueTypes as i, LoopTemplate as j, Col as k, loadChuckStore as l, useNormalFetch as m, FetchOverrides as n, createFetcher as o, useFetchOData as p, LoadChunkStoreArgs as r, createUniqueFetcher as s, _default as t, parseDxError as u, FilterExpression as v, ValidateError as w, Schema as x, Format as y, TanstackFetchOptions as z };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { i as monoEcosystem, n as MonoEcosystemOptions, r as mergeEcosystem } from "./merge-file-C5nzi_MY.js";
|
|
2
|
+
import { Plugin } from "vite";
|
|
3
|
+
|
|
4
|
+
//#region src/composables/vite-html-to-vue.d.ts
|
|
5
|
+
type HtmlToVueOptions = {
|
|
6
|
+
overridePath?: string;
|
|
7
|
+
components?: {
|
|
8
|
+
path: string;
|
|
9
|
+
outDir?: string;
|
|
10
|
+
};
|
|
11
|
+
pages: {
|
|
12
|
+
list: Array<{
|
|
13
|
+
html: string;
|
|
14
|
+
pagePath?: string;
|
|
15
|
+
}>;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
declare function htmlToVue(options: HtmlToVueOptions): Plugin;
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/composables/html-path.d.ts
|
|
21
|
+
declare function htmlPath({
|
|
22
|
+
dir,
|
|
23
|
+
dirname
|
|
24
|
+
}: {
|
|
25
|
+
dir: string;
|
|
26
|
+
dirname: string;
|
|
27
|
+
}): Record<string, string>;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { type MonoEcosystemOptions, htmlPath, htmlToVue, mergeEcosystem, monoEcosystem };
|