@websolutespa/bom-core 1.10.0-next.1 → 2.0.1-next.2
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/CHANGELOG.md +24 -0
- package/dist/index.d.ts +14 -8
- package/dist/index.js +15 -4
- package/package.json +24 -23
- package/dist/index.cjs +0 -1950
- package/dist/index.d.cts +0 -1363
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @websolutespa/bom-core
|
|
2
2
|
|
|
3
|
+
## 2.0.1-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updating: dependencies and build step
|
|
8
|
+
|
|
9
|
+
## 2.0.1-next.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- e74b305: Release: Payload 3.7.0
|
|
14
|
+
|
|
3
15
|
## 1.10.0-next.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -12,6 +24,18 @@
|
|
|
12
24
|
|
|
13
25
|
- Updating: React 19.x, Payload 3.x
|
|
14
26
|
|
|
27
|
+
## 1.8.22
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Fixing: JsonService whereItem\_ unresolved relations
|
|
32
|
+
|
|
33
|
+
## 1.8.21
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- Modified: IMeta
|
|
38
|
+
|
|
15
39
|
## 1.8.20
|
|
16
40
|
|
|
17
41
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IncomingMessage, ServerResponse, IncomingHttpHeaders } from 'http';
|
|
2
|
-
import { ParsedUrlQuery } from 'querystring';
|
|
3
|
-
import
|
|
1
|
+
import { IncomingMessage, ServerResponse, IncomingHttpHeaders } from 'node:http';
|
|
2
|
+
import { ParsedUrlQuery } from 'node:querystring';
|
|
3
|
+
import { FC } from 'react';
|
|
4
4
|
|
|
5
5
|
declare function base64ToString(text: string): string;
|
|
6
6
|
declare function stringToBase64(text: string): string;
|
|
@@ -20,11 +20,13 @@ type IContextParams = IContextBaseParams & {
|
|
|
20
20
|
};
|
|
21
21
|
type StaticPropsContext<Q extends ParsedUrlQuery = ParsedUrlQuery, D extends PreviewData = PreviewData> = {
|
|
22
22
|
params: Q;
|
|
23
|
-
|
|
24
|
-
previewData?: D;
|
|
23
|
+
draftMode?: boolean;
|
|
25
24
|
locale?: string;
|
|
26
25
|
locales?: string[];
|
|
27
26
|
defaultLocale?: string;
|
|
27
|
+
revalidateReason?: 'build' | 'stale' | 'on-demand';
|
|
28
|
+
preview?: boolean;
|
|
29
|
+
previewData?: D;
|
|
28
30
|
};
|
|
29
31
|
type IStaticContext<T extends {} = {}> = StaticPropsContext<IContextParams & T>;
|
|
30
32
|
declare type NextApiRequestCookies = Partial<{
|
|
@@ -36,13 +38,15 @@ type ServerSidePropsContext<Q extends ParsedUrlQuery = ParsedUrlQuery, D extends
|
|
|
36
38
|
};
|
|
37
39
|
res: ServerResponse;
|
|
38
40
|
params: Q;
|
|
41
|
+
draftMode?: boolean;
|
|
39
42
|
query: ParsedUrlQuery;
|
|
40
|
-
preview?: boolean;
|
|
41
|
-
previewData?: D;
|
|
42
43
|
resolvedUrl: string;
|
|
43
44
|
locale?: string;
|
|
44
45
|
locales?: string[];
|
|
45
46
|
defaultLocale?: string;
|
|
47
|
+
revalidateReason?: 'build' | 'stale' | 'on-demand';
|
|
48
|
+
preview?: boolean;
|
|
49
|
+
previewData?: D;
|
|
46
50
|
};
|
|
47
51
|
type IServerSideSplatContext<T extends {} = {}> = ServerSidePropsContext<IContextBaseParams & T>;
|
|
48
52
|
type IServerSideContext<T extends {} = {}> = ServerSidePropsContext<IContextParams & T>;
|
|
@@ -240,6 +244,7 @@ type IMeta = {
|
|
|
240
244
|
description?: string;
|
|
241
245
|
keywords?: string;
|
|
242
246
|
robots?: string;
|
|
247
|
+
image?: IMedia;
|
|
243
248
|
};
|
|
244
249
|
|
|
245
250
|
type ICategory = IEntity & {
|
|
@@ -886,6 +891,7 @@ declare class JsonService<T extends IEntity = IEntity> implements IQuerable<T> {
|
|
|
886
891
|
items: T[];
|
|
887
892
|
constructor(items: T[]);
|
|
888
893
|
getItems<B extends T = T>(): Promise<B[]>;
|
|
894
|
+
protected whereId_(id: IEquatable): WhereField;
|
|
889
895
|
findOne<B extends T = T>(id: IEquatable, params?: QueryParams): Promise<B | undefined>;
|
|
890
896
|
findMany<B extends T = T>(params?: QueryParams): Promise<B[]>;
|
|
891
897
|
findPaged<B extends T = T>(params?: QueryParams): Promise<IPagedResult<B>>;
|
|
@@ -1355,7 +1361,7 @@ declare const isProduction: boolean;
|
|
|
1355
1361
|
declare const isStage: boolean;
|
|
1356
1362
|
declare const isBrowser: boolean;
|
|
1357
1363
|
declare function getEnv(): Record<string, Json>;
|
|
1358
|
-
declare function withSchema<Component extends
|
|
1364
|
+
declare function withSchema<Component extends FC<any>, Schema>(component: Component, schema: Schema): Component & Schema;
|
|
1359
1365
|
declare function asServerProps(props: any): any;
|
|
1360
1366
|
declare function awaitAll(array: any, callback: (item: any, index: number) => Promise<any>): Promise<any[]>;
|
|
1361
1367
|
declare function merge(target: any, source: any): any;
|
package/dist/index.js
CHANGED
|
@@ -830,10 +830,17 @@ var JsonService = class {
|
|
|
830
830
|
async getItems() {
|
|
831
831
|
return this.items;
|
|
832
832
|
}
|
|
833
|
+
whereId_(id) {
|
|
834
|
+
return typeof id === "string" && /^[0-9]+$/.test(id) ? {
|
|
835
|
+
in: [id, parseInt(id)]
|
|
836
|
+
} : {
|
|
837
|
+
equals: id
|
|
838
|
+
};
|
|
839
|
+
}
|
|
833
840
|
async findOne(id, params = {}) {
|
|
834
841
|
let items = await this.getItems();
|
|
835
842
|
params.where = params.where || {};
|
|
836
|
-
params.where.id = params.where.id ||
|
|
843
|
+
params.where.id = params.where.id || this.whereId_(id);
|
|
837
844
|
items = this.whereItems_(items, params.where);
|
|
838
845
|
if (items.length > 0) {
|
|
839
846
|
return await this.decorateOne_(items[0], params);
|
|
@@ -878,7 +885,7 @@ var JsonService = class {
|
|
|
878
885
|
async updateOne(id, payload, params = {}) {
|
|
879
886
|
let items = await this.getItems();
|
|
880
887
|
params.where = params.where || {};
|
|
881
|
-
params.where.id = params.where.id ||
|
|
888
|
+
params.where.id = params.where.id || this.whereId_(id);
|
|
882
889
|
const whereItems = this.whereItems_(items, params.where);
|
|
883
890
|
if (whereItems.length > 0) {
|
|
884
891
|
const index = items.indexOf(whereItems[0]);
|
|
@@ -916,7 +923,7 @@ var JsonService = class {
|
|
|
916
923
|
async deleteOne(id, params = {}) {
|
|
917
924
|
let items = await this.getItems();
|
|
918
925
|
params.where = params.where || {};
|
|
919
|
-
params.where.id = params.where.id ||
|
|
926
|
+
params.where.id = params.where.id || this.whereId_(id);
|
|
920
927
|
const whereItems = this.whereItems_(items, params.where);
|
|
921
928
|
if (whereItems.length > 0) {
|
|
922
929
|
const index = items.indexOf(whereItems[0]);
|
|
@@ -1224,7 +1231,11 @@ function getValue(item, key) {
|
|
|
1224
1231
|
const keys = key.split(".");
|
|
1225
1232
|
const value = keys.reduce((p, c) => {
|
|
1226
1233
|
if (isObject(p)) {
|
|
1227
|
-
|
|
1234
|
+
const v = p[c];
|
|
1235
|
+
if (isUnresolvedRelation(v)) {
|
|
1236
|
+
return v.value;
|
|
1237
|
+
}
|
|
1238
|
+
return v;
|
|
1228
1239
|
} else {
|
|
1229
1240
|
return void 0;
|
|
1230
1241
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@websolutespa/bom-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1-next.2",
|
|
4
4
|
"description": "Core module of the BOM Repository",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bom",
|
|
@@ -14,41 +14,42 @@
|
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
16
|
"lint": "eslint *.ts*",
|
|
17
|
-
"test": "
|
|
18
|
-
"test-watch": "
|
|
19
|
-
"coverage:integration": "npm run test -- --coverage",
|
|
17
|
+
"test": "vitest run",
|
|
18
|
+
"test-watch": "vitest",
|
|
19
|
+
"coverage:integration": "npm run test -- --coverage.enabled --coverage.provider=istanbul --coverage.all",
|
|
20
20
|
"coverage": "run-s -c --silent coverage:*",
|
|
21
|
-
"compile": "tsup ./src/index.ts --format esm
|
|
21
|
+
"compile": "tsup ./src/index.ts --format esm --dts --external react",
|
|
22
22
|
"prepack": "bom prepack",
|
|
23
|
-
"postpack": "bom postpack"
|
|
23
|
+
"postpack": "bom postpack",
|
|
24
|
+
"types": "tsc --noemit"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
|
-
"pluralize": "
|
|
27
|
-
},
|
|
28
|
-
"peerDependencies": {
|
|
29
|
-
"next": ">= 15.3.0"
|
|
27
|
+
"pluralize": "8.0.0"
|
|
30
28
|
},
|
|
29
|
+
"peerDependencies": {},
|
|
31
30
|
"devDependencies": {
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
34
|
-
"@websolutespa/
|
|
35
|
-
"@websolutespa/
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
31
|
+
"@types/pluralize": "0.0.33",
|
|
32
|
+
"@types/react": "19.2.1",
|
|
33
|
+
"@websolutespa/eslint-config": "2.0.1-next.2",
|
|
34
|
+
"@websolutespa/test": "2.0.1-next.2",
|
|
35
|
+
"@websolutespa/tsconfig": "2.0.1-next.2",
|
|
36
|
+
"eslint": "9.31.0",
|
|
37
|
+
"npm-run-all": "4.1.5",
|
|
38
|
+
"raw-loader": "4.0.2",
|
|
39
|
+
"react": "19.2.1",
|
|
40
|
+
"tsup": "8.5.0",
|
|
41
|
+
"typescript": "5.8.3",
|
|
42
|
+
"vitest": "3.2.3"
|
|
42
43
|
},
|
|
43
|
-
"type": "module",
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
47
|
"sideEffects": false,
|
|
48
|
+
"type": "module",
|
|
48
49
|
"prepack": {
|
|
49
50
|
"types": "./dist/index.d.ts",
|
|
50
51
|
"main": "./dist/index.js",
|
|
51
|
-
"module": "./dist/index.
|
|
52
|
+
"module": "./dist/index.js"
|
|
52
53
|
},
|
|
53
54
|
"postpack": {
|
|
54
55
|
"types": "./src/index.ts",
|
|
@@ -56,5 +57,5 @@
|
|
|
56
57
|
},
|
|
57
58
|
"types": "./dist/index.d.ts",
|
|
58
59
|
"main": "./dist/index.js",
|
|
59
|
-
"module": "./dist/index.
|
|
60
|
+
"module": "./dist/index.js"
|
|
60
61
|
}
|