@stacksjs/types 0.41.1 → 0.42.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/README.md CHANGED
@@ -40,7 +40,7 @@ Please see our [releases](https://github.com/stacksjs/stacks/releases) page for
40
40
 
41
41
  ## 💪🏼 Contributing
42
42
 
43
- Please see [CONTRIBUTING](../../.github/CONTRIBUTING.md) for details.
43
+ Please review the [Contributing Guide](https://github.com/stacksjs/contributing) for details.
44
44
 
45
45
  ## 🏝 Community
46
46
 
@@ -50,7 +50,7 @@ For help, discussion about best practices, or any other conversation that would
50
50
 
51
51
  For casual chit-chat with others using this package:
52
52
 
53
- [Join the Open Web Discord Server](https://discord.ow3.org)
53
+ [Join the Stacks Discord Server](https://discord.ow3.org)
54
54
 
55
55
  ## 📄 License
56
56
 
package/dist/cli.d.ts CHANGED
@@ -72,7 +72,7 @@ export type CreateOptions = {
72
72
  } & {
73
73
  [key in CreateStringOption]: string;
74
74
  } & CliOptions;
75
- export type DevOption = 'components' | 'docs' | 'pages' | 'functions' | 'all';
75
+ export type DevOption = 'components' | 'docs' | 'pages' | 'functions' | 'desktop' | 'all';
76
76
  export type DevOptions = {
77
77
  [key in DevOption]: boolean;
78
78
  } & CliOptions;
@@ -137,6 +137,7 @@ export declare const enum NpmScript {
137
137
  Dev = "dev",
138
138
  DevComponents = "dev:components",
139
139
  DevDocs = "dev:docs",
140
+ DevDesktop = "dev:desktop",
140
141
  DevPages = "dev:pages",
141
142
  DevFunctions = "dev:functions",
142
143
  Fresh = "fresh",
package/dist/cli.mjs CHANGED
@@ -9,6 +9,7 @@ export var NpmScript = /* @__PURE__ */ ((NpmScript2) => {
9
9
  NpmScript2["Dev"] = "dev";
10
10
  NpmScript2["DevComponents"] = "dev:components";
11
11
  NpmScript2["DevDocs"] = "dev:docs";
12
+ NpmScript2["DevDesktop"] = "dev:desktop";
12
13
  NpmScript2["DevPages"] = "dev:pages";
13
14
  NpmScript2["DevFunctions"] = "dev:functions";
14
15
  NpmScript2["Fresh"] = "fresh";
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ export * from './library';
18
18
  export * from './manifest';
19
19
  export * from './markdown';
20
20
  export * from './pages';
21
+ export * from './promise';
21
22
  export * from './pwa';
22
23
  export * from './search-engine';
23
24
  export * from './ssg';
package/dist/index.mjs CHANGED
@@ -18,6 +18,7 @@ export * from "./library.mjs";
18
18
  export * from "./manifest.mjs";
19
19
  export * from "./markdown.mjs";
20
20
  export * from "./pages.mjs";
21
+ export * from "./promise.mjs";
21
22
  export * from "./pwa.mjs";
22
23
  export * from "./search-engine.mjs";
23
24
  export * from "./ssg.mjs";
@@ -0,0 +1 @@
1
+ export type MaybePromise<T> = T | Promise<T>;
File without changes
@@ -1,3 +1,6 @@
1
+ import type { EnqueuedTask, Hits, Index, IndexOptions, IndexesResults, MeiliSearch, Document as Record, DocumentOptions as RecordOptions, Documents as Records, DocumentsResults as RecordsResults, Settings as SearchEngineSettings, SearchParams, SearchResponse } from 'meilisearch';
2
+ import type { MaybePromise } from '.';
3
+ export type { EnqueuedTask, Hits, Index, IndexOptions, IndexesResults, MeiliSearch, Record, RecordOptions, Records, RecordsResults, SearchEngineSettings, SearchParams, SearchResponse };
1
4
  export interface SearchEngineOptions {
2
5
  /**
3
6
  * ### Search Engine Driver
@@ -9,3 +12,73 @@ export interface SearchEngineOptions {
9
12
  */
10
13
  driver: 'meilisearch' | 'algolia';
11
14
  }
15
+ type Search = any;
16
+ export interface SearchEngineDriver {
17
+ client: MeiliSearch;
18
+ createIndex: (name: string, options?: IndexOptions) => MaybePromise<EnqueuedTask>;
19
+ getIndex: (name: string) => MaybePromise<Index>;
20
+ updateIndex?: (name: string, options: IndexOptions) => MaybePromise<EnqueuedTask>;
21
+ deleteIndex?: (name: string) => MaybePromise<EnqueuedTask>;
22
+ updateIndexSettings: (name: string, settings: SearchEngineSettings) => MaybePromise<EnqueuedTask>;
23
+ listAllIndexes: () => MaybePromise<IndexesResults<Index[]>>;
24
+ listAllIndices: () => MaybePromise<IndexesResults<Index[]>>;
25
+ getRecord?: (key: string) => MaybePromise<Record>;
26
+ getRecords?: (key: string) => MaybePromise<RecordOptions>;
27
+ createRecord?: (record: Record, indexName: string, options: RecordOptions) => MaybePromise<EnqueuedTask>;
28
+ createRecords?: (records: Records, indexName: string, options: RecordOptions) => MaybePromise<EnqueuedTask>;
29
+ createOrReplaceRecord?: (record: Record, indexName: string, options: RecordOptions) => MaybePromise<EnqueuedTask>;
30
+ createOrUpdateRecord?: (record: Record, indexName: string, options: RecordOptions) => MaybePromise<EnqueuedTask>;
31
+ deleteRecord?: (recordId: string | number, indexName: string) => MaybePromise<EnqueuedTask>;
32
+ deleteAllRecords?: (indexName: string) => MaybePromise<EnqueuedTask>;
33
+ batchDeleteRecords?: (recordIds: string[] | number[], indexName: string) => MaybePromise<EnqueuedTask>;
34
+ search?: (query: string, indexName: string, options: SearchParams) => MaybePromise<Search>;
35
+ calculatePagination: any;
36
+ currentPage: any;
37
+ filterName: any;
38
+ filters: any;
39
+ goToNextPage: any;
40
+ goToPage: any;
41
+ goToPrevPage: any;
42
+ hits: any;
43
+ index: any;
44
+ lastPageNumber: any;
45
+ perPage: any;
46
+ query: any;
47
+ results: any;
48
+ searchFilters: any;
49
+ searchParams: any;
50
+ setTotalHits: any;
51
+ sort: any;
52
+ sorts: any;
53
+ totalPages: any;
54
+ }
55
+ /**
56
+ * the TableStore interface is primarily used to unify the persisting of data to localStorage
57
+ */
58
+ export interface SearchEngineStorage {
59
+ /**
60
+ * The search engine index name.
61
+ * i.e. the type of table, like `users`, `posts`, `products`, etc.
62
+ */
63
+ index?: string;
64
+ /**
65
+ * The search engine results object.
66
+ */
67
+ results?: SearchResponse;
68
+ /**
69
+ * The search engine hits object.
70
+ */
71
+ hits?: Hits;
72
+ /**
73
+ * The number of hits to be returned per page.
74
+ *
75
+ * @default number 20
76
+ */
77
+ perPage: number;
78
+ /**
79
+ * The current page number.
80
+ *
81
+ * @default number 1
82
+ */
83
+ currentPage: number;
84
+ }
package/dist/utils.d.ts CHANGED
@@ -1,27 +1,11 @@
1
1
  /**
2
- * Promise, or maybe not
3
- */
4
- export type Awaitable<T> = T | PromiseLike<T>;
5
- /**
6
- * Null or whatever
2
+ * Null or whatever.
7
3
  */
8
4
  export type Nullable<T> = T | null | undefined;
9
5
  /**
10
- * Array, or not yet
11
- */
12
- export type Arrayable<T> = T | Array<T>;
13
- /**
14
- * Function
15
- */
16
- export type Fn<T = void> = () => T;
17
- /**
18
- * Constructor
6
+ * Constructor.
19
7
  */
20
8
  export type Constructor<T = void> = new (...args: any[]) => T;
21
- /**
22
- * Infers the element type of an array
23
- */
24
- export type ElementOf<T> = T extends (infer E)[] ? E : never;
25
9
  /**
26
10
  * Defines an intersection type of all union items.
27
11
  *
@@ -30,10 +14,6 @@ export type ElementOf<T> = T extends (infer E)[] ? E : never;
30
14
  * @see https://stackoverflow.com/a/50375286/9259330
31
15
  */
32
16
  export type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
33
- /**
34
- * Infers the arguments type of a function
35
- */
36
- export type ArgumentsType<T> = T extends ((...args: infer A) => any) ? A : never;
37
17
  export type MergeInsertions<T> = T extends object ? {
38
18
  [K in keyof T]: MergeInsertions<T[K]>;
39
19
  } : T;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@stacksjs/types",
3
3
  "type": "module",
4
- "version": "0.41.1",
5
- "packageManager": "pnpm@7.16.0",
4
+ "version": "0.42.1",
5
+ "packageManager": "pnpm@7.17.0",
6
6
  "description": "The Stacks framework types.",
7
7
  "author": "Chris Breuer",
8
8
  "license": "MIT",
@@ -34,7 +34,7 @@
34
34
  ],
35
35
  "engines": {
36
36
  "node": ">=v18.12.1",
37
- "pnpm": ">=7.16.0"
37
+ "pnpm": ">=7.17.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@mdit-vue/plugin-component": "^0.11.1",
@@ -55,11 +55,11 @@
55
55
  "markdown-it": "^13.0.1",
56
56
  "mkdist": "^1.0.0",
57
57
  "typescript": "^4.9.3",
58
- "unplugin-auto-import": "^0.11.4",
59
- "unplugin-vue-components": "^0.22.9",
60
- "vite-plugin-inspect": "^0.7.8",
58
+ "unplugin-auto-import": "^0.11.5",
59
+ "unplugin-vue-components": "^0.22.11",
60
+ "vite-plugin-inspect": "^0.7.9",
61
61
  "vite-plugin-vue-layouts": "^0.7.0",
62
- "vite-ssg": "^0.21.2",
62
+ "vite-ssg": "^0.22.0",
63
63
  "vitepress": "1.0.0-alpha.29"
64
64
  },
65
65
  "scripts": {