@mono-lit/utility 0.0.1 → 0.0.3
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 -54
- package/README.md +156 -156
- package/dist/{app-roots-BJsIxzjk.d.ts → app-roots-DK41xMWj.d.ts} +1 -2
- package/dist/config-node.d.ts +134 -188
- package/dist/config-node.js +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/{create-config-D3m6xTaQ.d.ts → create-config-B8IhX4ht.d.ts} +5 -3
- package/dist/fetching.d.ts +51 -46
- package/dist/fetching.js +163 -15
- package/dist/{index-C2hZeNkq.d.ts → index-BAy6tbOG.d.ts} +12 -6
- package/dist/{index-ClrZbU7n.d.ts → index-DYlzhHq7.d.ts} +83 -87
- package/dist/index.d.ts +3 -7
- package/dist/index.js +5 -3
- package/dist/{merge-file-C5nzi_MY.d.ts → merge-file-CLc3wxY4.d.ts} +5 -28
- package/dist/{mock-db-5mJTObSC.js → mock-db-4tTWrF-P.js} +12 -12
- package/dist/mock-db.d.ts +1 -1
- package/dist/mock-db.js +1 -1
- package/dist/mono-db.d.ts +1 -1
- package/dist/mono-db.js +115 -108
- package/dist/mono-prepare.d.ts +1 -1
- package/dist/mono-prepare.js +3 -2
- package/dist/mono-skills.d.ts +1 -1
- package/dist/mono-skills.js +39 -32
- package/dist/nuxt-layers.d.ts +4 -2
- package/dist/nuxt-runtime.d.ts +4 -5
- package/dist/nuxt-runtime.js +1 -1
- package/dist/nuxt.d.ts +42 -38
- package/dist/nuxt.js +153 -6
- package/dist/{runtime-C_IWNrAG.js → runtime-vs7U9Ed4.js} +394 -157
- package/dist/runtime.d.ts +68 -133
- package/dist/runtime.js +2 -2
- package/dist/{session-Bk985AIM.js → session-Bcig-rPi.js} +4 -4
- package/dist/{universal-B2eD9xho.d.ts → universal-BR0O7Qwk.d.ts} +8 -46
- package/dist/{universal-BNTo_83u.js → universal-DIVEzCvN.js} +3 -2
- package/dist/vite.d.ts +44 -41
- package/package.json +11 -15
|
@@ -9,7 +9,6 @@ import { DxColumn, DxDataGrid, DxDataGridTypes } from "devextreme-vue/data-grid"
|
|
|
9
9
|
import { ObjectSchema } from "yup";
|
|
10
10
|
import { QBooleanPath, QDateTimeOffsetPath, QEntityCollectionPath, QEntityPath, QNumberPath, QStringPath } from "@odata2ts/odata-query-objects";
|
|
11
11
|
import { LoadOptions } from "devextreme/data";
|
|
12
|
-
|
|
13
12
|
//#region src/core/composables/use-static-datasource.d.ts
|
|
14
13
|
type AnyObj = Record<string, any>;
|
|
15
14
|
type DxFilter = [string, '=' | '<>' | '>' | '>=' | '<' | '<=' | 'contains' | 'notcontains' | 'startswith' | 'endswith', any] | ['!', DxFilter] | [DxFilter, 'and' | 'or', DxFilter] | any[];
|
|
@@ -84,23 +83,13 @@ type NotifProps = {
|
|
|
84
83
|
//#region src/core/composables/use-helper.d.ts
|
|
85
84
|
declare const useHelper: () => {
|
|
86
85
|
isDate: (value: unknown) => value is Date;
|
|
87
|
-
isJSONString: ({
|
|
88
|
-
input,
|
|
89
|
-
strict,
|
|
90
|
-
root
|
|
91
|
-
}: {
|
|
86
|
+
isJSONString: ({ input, strict, root }: {
|
|
92
87
|
input: unknown;
|
|
93
88
|
strict?: boolean;
|
|
94
89
|
root?: ("object" | "any" | "array" | "primitive") | ReadonlyArray<"object" | "any" | "array" | "primitive">;
|
|
95
90
|
}) => boolean;
|
|
96
91
|
safeJSONParse: (str: string) => any;
|
|
97
|
-
replacerData: <ComT>({
|
|
98
|
-
fn,
|
|
99
|
-
type,
|
|
100
|
-
item,
|
|
101
|
-
key,
|
|
102
|
-
items
|
|
103
|
-
}: {
|
|
92
|
+
replacerData: <ComT>({ fn, type, item, key, items }: {
|
|
104
93
|
fn: "push" | "remove" | "replace";
|
|
105
94
|
type: "data";
|
|
106
95
|
item: ComT;
|
|
@@ -120,30 +109,17 @@ declare const useHelper: () => {
|
|
|
120
109
|
};
|
|
121
110
|
}) => void;
|
|
122
111
|
filterOrIn: (field: string, values: any[], combine?: boolean) => any;
|
|
123
|
-
validateAllSchema: <T extends object = any>({
|
|
124
|
-
|
|
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>;
|
|
112
|
+
validateAllSchema: <T extends object = any>({ schema, input, error }: ValidateSchema<T>, callback?: () => void) => Promise<boolean>;
|
|
113
|
+
validateSchema: <T = any>({ schema, field, input, error }: ValidateSchema<T>, callback?: Function) => Promise<boolean>;
|
|
134
114
|
validateAllSchemaCheck: (error: ValidateError<any>) => boolean;
|
|
135
|
-
clearSchemaValidation: ({
|
|
136
|
-
error
|
|
137
|
-
}: {
|
|
115
|
+
clearSchemaValidation: ({ error }: {
|
|
138
116
|
error: Ref<any>;
|
|
139
117
|
}) => void;
|
|
140
118
|
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;
|
|
119
|
+
dxFilterToString: ({ filter, encode }: {
|
|
120
|
+
/** encode only the filter value (URL-safe), default false */
|
|
121
|
+
encode?: boolean;
|
|
122
|
+
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
123
|
}) => string;
|
|
148
124
|
};
|
|
149
125
|
//#endregion
|
|
@@ -249,7 +225,9 @@ interface TanstackFetchOptions {
|
|
|
249
225
|
networkMode?: 'online' | 'always' | 'offlineFirst';
|
|
250
226
|
/** Keep reads across page reloads (IndexedDB by default). Results must be JSON-safe. */
|
|
251
227
|
persist?: boolean | {
|
|
252
|
-
/** ms a persisted read is kept (default 24 h). */
|
|
228
|
+
/** ms a persisted read is kept (default 24 h). */
|
|
229
|
+
maxAge?: number;
|
|
230
|
+
/** Entries persisted under another buster are discarded — use the user id / app version. */
|
|
253
231
|
buster?: string;
|
|
254
232
|
storage?: 'indexeddb' | 'local';
|
|
255
233
|
};
|
|
@@ -270,6 +248,13 @@ type NormalFetchOptions = RequestInit & {
|
|
|
270
248
|
unauthCall?: () => void;
|
|
271
249
|
expiredBehaviour?: 'refresh';
|
|
272
250
|
tokenOptions?: MonoFetchCookieOptions;
|
|
251
|
+
/**
|
|
252
|
+
* Instant first load in a Nuxt app with `@mono-lit/nuxt-pre-fetch` (learned requests): this
|
|
253
|
+
* GET is reported to Nitro, which replays it on the next visit of the page while producing
|
|
254
|
+
* the HTML; the call then gets its answer without a network round trip. No effect without
|
|
255
|
+
* the module.
|
|
256
|
+
*/
|
|
257
|
+
prefetch?: boolean;
|
|
273
258
|
};
|
|
274
259
|
type NormalFetchResult<T> = {
|
|
275
260
|
statusCode: number;
|
|
@@ -300,20 +285,27 @@ interface OdataFetchTypes<T = any> extends FetchOData<T>, FetchRequestConfig {
|
|
|
300
285
|
tokenOptions?: MonoFetchCookieOptions;
|
|
301
286
|
/** Opt-in TanStack Query behaviour for the stores this fetch builds (see TanstackFetchOptions). */
|
|
302
287
|
tanstack?: TanstackFetchOptions;
|
|
288
|
+
/**
|
|
289
|
+
* Instant first load in a Nuxt app with `@mono-lit/nuxt-pre-fetch` (learned requests): the
|
|
290
|
+
* store's FIRST load is reported to Nitro and answered from its copy on the next visit.
|
|
291
|
+
* Needs a data layer that implements it (`@mono-lit/data`); a no-op with plain DevExtreme.
|
|
292
|
+
*/
|
|
293
|
+
prefetch?: boolean;
|
|
303
294
|
}
|
|
304
295
|
//#endregion
|
|
305
296
|
//#region src/core/types/column.d.ts
|
|
306
297
|
// primitives / built-ins we don't want to recurse into
|
|
307
|
-
type BuiltIn = Date | Function | RegExp | Error;
|
|
298
|
+
type BuiltIn = Date | Function | RegExp | Error;
|
|
299
|
+
// treat only plain objects (not arrays, not built-ins) as nestable
|
|
308
300
|
type IsPlainObject<T> = T extends object ? T extends BuiltIn ? false : T extends readonly any[] ? false : true : false;
|
|
309
301
|
/** "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;
|
|
302
|
+
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
303
|
/** Optional: value type at a given dot-path */
|
|
312
304
|
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
305
|
// --- Your Col type using DotKeys<T> and allowing extra keys I[number] ---
|
|
314
306
|
type Col<T = any, I extends readonly string[] = []> = InstanceType<typeof DxColumn>["$props"] & {
|
|
315
307
|
dataField: [keyof T] extends [never] ? I[number] | string // when T is unknown/empty
|
|
316
|
-
|
|
308
|
+
: I[number] | DotKeys<T>; // typed dot-paths + extras
|
|
317
309
|
cellTemplate?: [keyof T] extends [never] ? string : `${Extract<DotKeys<T>, string>}Template` | (string & {}) | ((container: HTMLElement, options: DxDataGridTypes.ColumnCellTemplateData) => void);
|
|
318
310
|
groupCellTemplate?: [keyof T] extends [never] ? string : `${Extract<DotKeys<T>, string>}GroupTemplate`;
|
|
319
311
|
headerCellTemplate?: [keyof T] extends [never] ? string : `${Extract<DotKeys<T>, string>}HeaderTemplate`;
|
|
@@ -340,17 +332,17 @@ type ValidateErrorItem = {
|
|
|
340
332
|
message: string;
|
|
341
333
|
};
|
|
342
334
|
type ValidateError<T extends string = string> = Record<T, ValidateErrorItem>;
|
|
343
|
-
type WithUndefined<T> = { [P in keyof T]: T[P] | undefined };
|
|
335
|
+
type WithUndefined<T> = { [P in keyof T]: T[P] | undefined; };
|
|
344
336
|
interface SchemaType<T> extends WithUndefined<T> {}
|
|
345
337
|
interface Schema<T> extends ObjectSchema<SchemaType<T>> {}
|
|
346
338
|
type AnyObject = yup.AnyObject;
|
|
347
339
|
/** 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]
|
|
340
|
+
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
341
|
/** 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 };
|
|
342
|
+
type SchemaObject<T> = { [K in keyof T]-?: SchemaFor<T[K]>; };
|
|
343
|
+
type ValidateErrorSingle<T> = { [K in keyof T]: T[K] extends object ? ValidateError<T[K]> : ValidateErrorItem; };
|
|
352
344
|
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 };
|
|
345
|
+
: T[K] extends object ? ValidateErrorComplex<T[K]> : ValidateErrorItem; };
|
|
354
346
|
//#endregion
|
|
355
347
|
//#region src/core/types/devextreme.d.ts
|
|
356
348
|
type FilterExpression = "=" | "<>" | ">" | ">=" | "<" | "<=" | "startswith" | "endswith" | "contains" | "notcontains";
|
|
@@ -378,13 +370,51 @@ type DataGrid<T = {}> = (InstanceType<typeof DxDataGrid>['$props']) & {
|
|
|
378
370
|
};
|
|
379
371
|
//#endregion
|
|
380
372
|
//#region src/core/types/odatamap.d.ts
|
|
381
|
-
type Mutable<T> = { -readonly [P in keyof T]: T[P] };
|
|
373
|
+
type Mutable<T> = { -readonly [P in keyof T]: T[P]; };
|
|
382
374
|
type GetInstance<T> = T extends (new (...args: any) => infer I) ? I : T;
|
|
383
375
|
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
376
|
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]
|
|
377
|
+
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
378
|
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 };
|
|
379
|
+
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; };
|
|
380
|
+
//#endregion
|
|
381
|
+
//#region src/core/composables/prefetch-bridge.d.ts
|
|
382
|
+
/** One GET request as reported to the prefetch host. */
|
|
383
|
+
interface MonoPrefetchRequest {
|
|
384
|
+
/** Absolute or app-relative URL (may carry a query string). */
|
|
385
|
+
url: string;
|
|
386
|
+
query?: Record<string, unknown>;
|
|
387
|
+
/** Non-credential headers only (Authorization / Cookie are dropped). */
|
|
388
|
+
headers?: Record<string, string>;
|
|
389
|
+
/** The cookie the Bearer token is read from on the host (`split`: chunked cookie). */
|
|
390
|
+
auth?: {
|
|
391
|
+
cookie: string;
|
|
392
|
+
split?: boolean;
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
/** What a prefetch host provides (shape of `useNuxtApp().$nuxtPreFetch`). */
|
|
396
|
+
interface MonoPrefetchBridge {
|
|
397
|
+
/** Synchronous: a prefetched result is available (or arriving) for this request. */
|
|
398
|
+
expects: (method: string, url: string, query?: Record<string, unknown> | null) => boolean;
|
|
399
|
+
/** The prefetched result, once (`undefined` = fetch it yourself). */
|
|
400
|
+
take: (method: string, url: string, query?: Record<string, unknown> | null) => Promise<{
|
|
401
|
+
data: unknown;
|
|
402
|
+
} | undefined>;
|
|
403
|
+
/** Reports a request the page sent (served ones too). */
|
|
404
|
+
learn: (request: MonoPrefetchRequest) => void;
|
|
405
|
+
}
|
|
406
|
+
declare function setPrefetchBridge(next: MonoPrefetchBridge | null): void;
|
|
407
|
+
declare function getPrefetchBridge(): MonoPrefetchBridge | null;
|
|
408
|
+
/**
|
|
409
|
+
* Describing a call on a server (`.prefetch()` twins): where the store's first load goes
|
|
410
|
+
* instead of the network. `auth` is the cookie the browser's Bearer lives in.
|
|
411
|
+
*/
|
|
412
|
+
interface MonoPrefetchCapture {
|
|
413
|
+
emit: (request: MonoPrefetchRequest) => void;
|
|
414
|
+
auth?: MonoPrefetchRequest['auth'];
|
|
415
|
+
/** Describe ONE `store.load(load)` instead of the call's own first load (`.prefetchLoad()`). */
|
|
416
|
+
load?: Record<string, unknown>;
|
|
417
|
+
}
|
|
388
418
|
//#endregion
|
|
389
419
|
//#region src/core/composables/use-fetch-helper.d.ts
|
|
390
420
|
declare global {
|
|
@@ -404,29 +434,9 @@ declare function parseDxError(err: any): {
|
|
|
404
434
|
body: any;
|
|
405
435
|
err: any;
|
|
406
436
|
};
|
|
407
|
-
declare const useFetchOData: <T = any>({
|
|
408
|
-
|
|
409
|
-
|
|
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<{
|
|
437
|
+
declare const useFetchOData: <T = any>({ url, options, source, type, params, notif, force, token, headers, selfProxy, method, baseUrl, override, allowZero, cache, expiredBehaviour, unauthCall, payload, config, tokenOptions, tanstack, prefetch, __capture }: OdataFetchTypes & {
|
|
438
|
+
__capture?: MonoPrefetchCapture;
|
|
439
|
+
}) => Promise<{
|
|
430
440
|
data: T | null;
|
|
431
441
|
dataSource: DataSource<T> | null;
|
|
432
442
|
statusCode: number;
|
|
@@ -471,12 +481,7 @@ interface TryCatchDatasourceParams<T> {
|
|
|
471
481
|
finallyCallback?: () => Promise<any> | any;
|
|
472
482
|
notif?: OdataFetchTypes['notif'];
|
|
473
483
|
}
|
|
474
|
-
declare function tryCatchDatasource<T>({
|
|
475
|
-
tryCallback,
|
|
476
|
-
catchCallback,
|
|
477
|
-
finallyCallback,
|
|
478
|
-
notif
|
|
479
|
-
}: TryCatchDatasourceParams<T>): Promise<T>;
|
|
484
|
+
declare function tryCatchDatasource<T>({ tryCallback, catchCallback, finallyCallback, notif }: TryCatchDatasourceParams<T>): Promise<T>;
|
|
480
485
|
type LoadChunkStoreArgs<T> = {
|
|
481
486
|
datasource: DataSource<T>;
|
|
482
487
|
options: LoadOptions<T>;
|
|
@@ -484,14 +489,8 @@ type LoadChunkStoreArgs<T> = {
|
|
|
484
489
|
maxRows?: number;
|
|
485
490
|
concurrency?: number;
|
|
486
491
|
};
|
|
487
|
-
declare function loadChuckStore<T>({
|
|
488
|
-
|
|
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]> };
|
|
492
|
+
declare function loadChuckStore<T>({ datasource, options, limit, maxRows, concurrency }: LoadChunkStoreArgs<T>): Promise<T[]>;
|
|
493
|
+
type AwaitedMap<T extends Record<string, Promise<any>>> = { [K in keyof T]: Awaited<T[K]>; };
|
|
495
494
|
type SettledMap<T extends Record<string, Promise<any>>> = {
|
|
496
495
|
values: Partial<AwaitedMap<T>>;
|
|
497
496
|
errors: Partial<Record<keyof T, unknown>>;
|
|
@@ -500,10 +499,7 @@ type AllMap<T extends Record<string, Promise<any>>> = {
|
|
|
500
499
|
values: AwaitedMap<T>;
|
|
501
500
|
errors: {};
|
|
502
501
|
};
|
|
503
|
-
declare function promiseWrapper<T extends Record<string, Promise<any>>, Mode extends 'all' | 'allSettled' = 'allSettled'>({
|
|
504
|
-
task,
|
|
505
|
-
type
|
|
506
|
-
}: {
|
|
502
|
+
declare function promiseWrapper<T extends Record<string, Promise<any>>, Mode extends 'all' | 'allSettled' = 'allSettled'>({ task, type }: {
|
|
507
503
|
task: T;
|
|
508
504
|
type?: Mode;
|
|
509
505
|
}): Promise<Mode extends 'all' ? AllMap<T> : SettledMap<T>>;
|
|
@@ -515,4 +511,4 @@ type __VLS_Props = {
|
|
|
515
511
|
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
512
|
declare const _default: typeof __VLS_export;
|
|
517
513
|
//#endregion
|
|
518
|
-
export {
|
|
514
|
+
export { ValidateErrorItem as A, NormalFetchOptions as B, Format as C, SchemaType as D, SchemaObject as E, LoopTemplate as F, NotifProps as G, OdataFetchTypes as H, PathValue as I, MonoNotifButton as J, MonoNotifActionProps as K, FetchLoading as L, ValidateSchema as M, Col as N, ValidateError as O, GroupTemplate as P, FetchOData as R, FilterExpression as S, Schema as T, TanstackFetchOptions as U, NormalFetchResult as V, useHelper as W, createStaticDatasource as X, UseOdataStaticOpts as Y, getPrefetchBridge as _, TryCatchDatasourceParams as a, CustomSummary as b, extractErrorMessage as c, promiseWrapper as d, tryCatchDatasource as f, MonoPrefetchRequest as g, MonoPrefetchBridge as h, OdataFetchUniqueTypes as i, ValidateErrorSingle as j, ValidateErrorComplex as k, loadChuckStore as l, useNormalFetch as m, FetchOverrides as n, createFetcher as o, useFetchOData as p, MonoNotifActionTypes as q, LoadChunkStoreArgs as r, createUniqueFetcher as s, _default as t, parseDxError as u, setPrefetchBridge as v, HeaderFilter as w, DataGrid as x, OdataMapTypes as y, FetchParam as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { i as monoEcosystem, n as MonoEcosystemOptions, r as mergeEcosystem } from "./merge-file-
|
|
1
|
+
import { i as monoEcosystem, n as MonoEcosystemOptions, r as mergeEcosystem } from "./merge-file-CLc3wxY4.js";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
|
-
|
|
4
3
|
//#region src/composables/vite-html-to-vue.d.ts
|
|
5
4
|
type HtmlToVueOptions = {
|
|
6
5
|
overridePath?: string;
|
|
@@ -18,12 +17,9 @@ type HtmlToVueOptions = {
|
|
|
18
17
|
declare function htmlToVue(options: HtmlToVueOptions): Plugin;
|
|
19
18
|
//#endregion
|
|
20
19
|
//#region src/composables/html-path.d.ts
|
|
21
|
-
declare function htmlPath({
|
|
22
|
-
dir,
|
|
23
|
-
dirname
|
|
24
|
-
}: {
|
|
20
|
+
export declare function htmlPath({ dir, dirname }: {
|
|
25
21
|
dir: string;
|
|
26
22
|
dirname: string;
|
|
27
23
|
}): Record<string, string>;
|
|
28
24
|
//#endregion
|
|
29
|
-
export { type MonoEcosystemOptions,
|
|
25
|
+
export { type MonoEcosystemOptions, htmlToVue, mergeEcosystem, monoEcosystem };
|
package/dist/index.js
CHANGED
|
@@ -438,14 +438,16 @@ async function ensurePlainScriptModule(args) {
|
|
|
438
438
|
});
|
|
439
439
|
return `import ${JSON.stringify(toVueRelativeImport(outPath, cssOutPath))}`;
|
|
440
440
|
}
|
|
441
|
-
const
|
|
441
|
+
const childStem = `${outStem}-${fileBaseStem(resolved)}`;
|
|
442
|
+
const childRef = await ensurePlainScriptModule({
|
|
442
443
|
root,
|
|
443
444
|
sourceAbs: resolved,
|
|
444
|
-
outStem:
|
|
445
|
+
outStem: childStem,
|
|
445
446
|
emitted,
|
|
446
447
|
plainScriptCache,
|
|
447
448
|
styleCache
|
|
448
|
-
})
|
|
449
|
+
});
|
|
450
|
+
const nextSpec = toVueRelativeImport(outPath, childRef.outPath);
|
|
449
451
|
return clause ? `import ${clause} from ${JSON.stringify(nextSpec)}` : `import ${JSON.stringify(nextSpec)}`;
|
|
450
452
|
});
|
|
451
453
|
const ref = {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { o as MonoAppType } from "./create-config-
|
|
2
|
-
|
|
1
|
+
import { o as MonoAppType } from "./create-config-B8IhX4ht.js";
|
|
3
2
|
//#region src/composables/merge-file.d.ts
|
|
4
3
|
type EcoSub = "composables" | "stores" | "components";
|
|
5
4
|
type DirValue = string | string[];
|
|
@@ -54,20 +53,7 @@ type MergeEcosystemOptions<T = string> = {
|
|
|
54
53
|
appRoot: string;
|
|
55
54
|
}) => T;
|
|
56
55
|
};
|
|
57
|
-
declare function mergeEcosystem<T = string>({
|
|
58
|
-
dirname,
|
|
59
|
-
appDir,
|
|
60
|
-
appRoots,
|
|
61
|
-
includes,
|
|
62
|
-
excludes,
|
|
63
|
-
dir,
|
|
64
|
-
sub,
|
|
65
|
-
appDirs,
|
|
66
|
-
ecosystems,
|
|
67
|
-
dirIncludes,
|
|
68
|
-
dirExcludes,
|
|
69
|
-
map
|
|
70
|
-
}: MergeEcosystemOptions<T>): T[];
|
|
56
|
+
declare function mergeEcosystem<T = string>({ dirname, appDir, appRoots, includes, excludes, dir, sub, appDirs, ecosystems, dirIncludes, dirExcludes, map }: MergeEcosystemOptions<T>): T[];
|
|
71
57
|
type MonoEcosystemOptions = {
|
|
72
58
|
dirname: string;
|
|
73
59
|
/**
|
|
@@ -96,7 +82,8 @@ type MonoEcosystemOptions = {
|
|
|
96
82
|
*/
|
|
97
83
|
ecosystems?: Record<string, string[]>;
|
|
98
84
|
dirIncludes?: MatchValue[];
|
|
99
|
-
dirExcludes?: MatchValue[];
|
|
85
|
+
dirExcludes?: MatchValue[];
|
|
86
|
+
/** @deprecated `apps[].path` is authoritative in every command; ignored. */
|
|
100
87
|
link?: boolean;
|
|
101
88
|
};
|
|
102
89
|
/**
|
|
@@ -107,16 +94,6 @@ type MonoEcosystemOptions = {
|
|
|
107
94
|
* `.mono/apps/` clone, or the local checkout an app's `path` names. Returns
|
|
108
95
|
* absolute, existing dirs.
|
|
109
96
|
*/
|
|
110
|
-
declare function monoEcosystem({
|
|
111
|
-
dirname,
|
|
112
|
-
apps,
|
|
113
|
-
subs,
|
|
114
|
-
appDir,
|
|
115
|
-
includes,
|
|
116
|
-
excludes,
|
|
117
|
-
ecosystems,
|
|
118
|
-
dirIncludes,
|
|
119
|
-
dirExcludes
|
|
120
|
-
}: MonoEcosystemOptions): string[];
|
|
97
|
+
declare function monoEcosystem({ dirname, apps, subs, appDir, includes, excludes, ecosystems, dirIncludes, dirExcludes }: MonoEcosystemOptions): string[];
|
|
121
98
|
//#endregion
|
|
122
99
|
export { monoEcosystem as i, MonoEcosystemOptions as n, mergeEcosystem as r, MergeEcosystemOptions as t };
|
|
@@ -175,7 +175,7 @@ function applyTransforms(rows, transforms, compileFilter, readValue = readField$
|
|
|
175
175
|
|
|
176
176
|
//#endregion
|
|
177
177
|
//#region pkg/mock-db/odata.ts
|
|
178
|
-
const OPERATORS = new Set([
|
|
178
|
+
const OPERATORS = /* @__PURE__ */ new Set([
|
|
179
179
|
"eq",
|
|
180
180
|
"ne",
|
|
181
181
|
"gt",
|
|
@@ -679,7 +679,8 @@ function parseOrderBy(input) {
|
|
|
679
679
|
* expands.
|
|
680
680
|
*/
|
|
681
681
|
function parseExpand(input) {
|
|
682
|
-
|
|
682
|
+
const raw = Array.isArray(input) ? input.join(",") : String(input ?? "");
|
|
683
|
+
return splitTopLevel(raw, ",").map((part) => part.trim()).filter(Boolean).map((part) => {
|
|
683
684
|
const open = part.indexOf("(");
|
|
684
685
|
if (open < 0) return { name: part.trim() };
|
|
685
686
|
const name = part.slice(0, open).trim();
|
|
@@ -707,10 +708,7 @@ function parseExpand(input) {
|
|
|
707
708
|
case "$skip":
|
|
708
709
|
item.skip = Number(value);
|
|
709
710
|
break;
|
|
710
|
-
case "$expand":
|
|
711
|
-
item.expand = parseExpand(value);
|
|
712
|
-
break;
|
|
713
|
-
default: break;
|
|
711
|
+
case "$expand": item.expand = parseExpand(value);
|
|
714
712
|
}
|
|
715
713
|
}
|
|
716
714
|
return item;
|
|
@@ -1058,7 +1056,8 @@ function createMockDb(config) {
|
|
|
1058
1056
|
}
|
|
1059
1057
|
async function hydrate(force = false) {
|
|
1060
1058
|
if (!isIndexedDbAvailable()) return;
|
|
1061
|
-
|
|
1059
|
+
const db = await openMockDb(dbName, version, schemas);
|
|
1060
|
+
store = createMockStore(db);
|
|
1062
1061
|
for (const schema of schemas) {
|
|
1063
1062
|
const seed = generateSeed(schema, {
|
|
1064
1063
|
count: seedCount,
|
|
@@ -1131,12 +1130,13 @@ function createMockDb(config) {
|
|
|
1131
1130
|
}
|
|
1132
1131
|
}
|
|
1133
1132
|
}
|
|
1133
|
+
const result = executeQuery(rows, query, {
|
|
1134
|
+
entity,
|
|
1135
|
+
readEntity: (name) => related[name] ?? [],
|
|
1136
|
+
entityOf: (name) => schema.entities[name]
|
|
1137
|
+
});
|
|
1134
1138
|
return {
|
|
1135
|
-
data: toODataEnvelope(
|
|
1136
|
-
entity,
|
|
1137
|
-
readEntity: (name) => related[name] ?? [],
|
|
1138
|
-
entityOf: (name) => schema.entities[name]
|
|
1139
|
-
}), Boolean(query.count)),
|
|
1139
|
+
data: toODataEnvelope(result, Boolean(query.count)),
|
|
1140
1140
|
statusCode: 200,
|
|
1141
1141
|
error: null
|
|
1142
1142
|
};
|
package/dist/mock-db.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as parseFilter, B as MonoMockSchemaError, C as FilterContext, D as evaluateFilter, E as ODataResult, F as MonoMockField, H as normalizeSegment, I as MonoMockFieldType, L as MonoMockParsedEntity, M as parseQuery, N as toODataEnvelope, O as executeQuery, P as tokenize, R as MonoMockParsedSchema, S as ExpandItem, T as ODataQuery, U as parseField, V as matchMockRoute, W as parseMockSchema, _ as ApplyTransform, a as monoMockDb, b as applyTransforms, c as createMockStore, d as GenerateOptions, f as createRandom, g as AggregateSpec, h as AggregateMethod, i as createMockDb, j as parseKeySegment, k as parseExpand, l as isIndexedDbAvailable, m as orderEntitiesByDependency, n as MonoMockRequest, o as resetMonoMockDb, p as generateSeed, r as MonoMockResponse, s as MonoMockStore, t as MonoMockDb, u as openMockDb, v as CompileFilter, w as FilterNode, x as parseApply, y as ReadValue, z as MonoMockRelation } from "./index-
|
|
1
|
+
import { A as parseFilter, B as MonoMockSchemaError, C as FilterContext, D as evaluateFilter, E as ODataResult, F as MonoMockField, H as normalizeSegment, I as MonoMockFieldType, L as MonoMockParsedEntity, M as parseQuery, N as toODataEnvelope, O as executeQuery, P as tokenize, R as MonoMockParsedSchema, S as ExpandItem, T as ODataQuery, U as parseField, V as matchMockRoute, W as parseMockSchema, _ as ApplyTransform, a as monoMockDb, b as applyTransforms, c as createMockStore, d as GenerateOptions, f as createRandom, g as AggregateSpec, h as AggregateMethod, i as createMockDb, j as parseKeySegment, k as parseExpand, l as isIndexedDbAvailable, m as orderEntitiesByDependency, n as MonoMockRequest, o as resetMonoMockDb, p as generateSeed, r as MonoMockResponse, s as MonoMockStore, t as MonoMockDb, u as openMockDb, v as CompileFilter, w as FilterNode, x as parseApply, y as ReadValue, z as MonoMockRelation } from "./index-BAy6tbOG.js";
|
|
2
2
|
export { AggregateMethod, AggregateSpec, ApplyTransform, CompileFilter, ExpandItem, FilterContext, FilterNode, GenerateOptions, MonoMockDb, MonoMockField, MonoMockFieldType, MonoMockParsedEntity, MonoMockParsedSchema, MonoMockRelation, MonoMockRequest, MonoMockResponse, MonoMockSchemaError, MonoMockStore, ODataQuery, ODataResult, ReadValue, applyTransforms, createMockDb, createMockStore, createRandom, evaluateFilter, executeQuery, generateSeed, isIndexedDbAvailable, matchMockRoute, monoMockDb, normalizeSegment, openMockDb, orderEntitiesByDependency, parseApply, parseExpand, parseField, parseFilter, parseKeySegment, parseMockSchema, parseQuery, resetMonoMockDb, toODataEnvelope, tokenize };
|
package/dist/mock-db.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { a as normalizeSegment, i as matchMockRoute, n as generateSeed, o as parseField, r as orderEntitiesByDependency, s as parseMockSchema, t as createRandom } from "./generate-CJ7MtcDd.js";
|
|
2
|
-
import { a as isIndexedDbAvailable, c as executeQuery, d as parseKeySegment, f as parseQuery, g as parseApply, h as applyTransforms, i as createMockStore, l as parseExpand, m as tokenize, n as monoMockDb, o as openMockDb, p as toODataEnvelope, r as resetMonoMockDb, s as evaluateFilter, t as createMockDb, u as parseFilter } from "./mock-db-
|
|
2
|
+
import { a as isIndexedDbAvailable, c as executeQuery, d as parseKeySegment, f as parseQuery, g as parseApply, h as applyTransforms, i as createMockStore, l as parseExpand, m as tokenize, n as monoMockDb, o as openMockDb, p as toODataEnvelope, r as resetMonoMockDb, s as evaluateFilter, t as createMockDb, u as parseFilter } from "./mock-db-4tTWrF-P.js";
|
|
3
3
|
|
|
4
4
|
export { applyTransforms, createMockDb, createMockStore, createRandom, evaluateFilter, executeQuery, generateSeed, isIndexedDbAvailable, matchMockRoute, monoMockDb, normalizeSegment, openMockDb, orderEntitiesByDependency, parseApply, parseExpand, parseField, parseFilter, parseKeySegment, parseMockSchema, parseQuery, resetMonoMockDb, toODataEnvelope, tokenize };
|
package/dist/mono-db.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {}
|