@klerick/json-api-nestjs-shared 1.0.0-beta.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.
Files changed (51) hide show
  1. package/cjs/package.json +43 -0
  2. package/cjs/src/index.d.ts +3 -0
  3. package/cjs/src/index.js +7 -0
  4. package/cjs/src/index.js.map +1 -0
  5. package/cjs/src/lib/constants/index.d.ts +2 -0
  6. package/cjs/src/lib/constants/index.js +6 -0
  7. package/cjs/src/lib/constants/index.js.map +1 -0
  8. package/cjs/src/lib/types/entity-type.d.ts +19 -0
  9. package/cjs/src/lib/types/entity-type.js +3 -0
  10. package/cjs/src/lib/types/entity-type.js.map +1 -0
  11. package/cjs/src/lib/types/index.d.ts +3 -0
  12. package/cjs/src/lib/types/index.js +7 -0
  13. package/cjs/src/lib/types/index.js.map +1 -0
  14. package/cjs/src/lib/types/query-type.d.ts +39 -0
  15. package/cjs/src/lib/types/query-type.js +48 -0
  16. package/cjs/src/lib/types/query-type.js.map +1 -0
  17. package/cjs/src/lib/types/response-body.d.ts +53 -0
  18. package/cjs/src/lib/types/response-body.js +3 -0
  19. package/cjs/src/lib/types/response-body.js.map +1 -0
  20. package/cjs/src/lib/utils/index.d.ts +1 -0
  21. package/cjs/src/lib/utils/index.js +5 -0
  22. package/cjs/src/lib/utils/index.js.map +1 -0
  23. package/cjs/src/lib/utils/object-utils.d.ts +10 -0
  24. package/cjs/src/lib/utils/object-utils.js +46 -0
  25. package/cjs/src/lib/utils/object-utils.js.map +1 -0
  26. package/mjs/package.json +41 -0
  27. package/mjs/src/index.d.ts +3 -0
  28. package/mjs/src/index.js +4 -0
  29. package/mjs/src/index.js.map +1 -0
  30. package/mjs/src/lib/constants/index.d.ts +2 -0
  31. package/mjs/src/lib/constants/index.js +3 -0
  32. package/mjs/src/lib/constants/index.js.map +1 -0
  33. package/mjs/src/lib/types/entity-type.d.ts +19 -0
  34. package/mjs/src/lib/types/entity-type.js +2 -0
  35. package/mjs/src/lib/types/entity-type.js.map +1 -0
  36. package/mjs/src/lib/types/index.d.ts +3 -0
  37. package/mjs/src/lib/types/index.js +4 -0
  38. package/mjs/src/lib/types/index.js.map +1 -0
  39. package/mjs/src/lib/types/query-type.d.ts +39 -0
  40. package/mjs/src/lib/types/query-type.js +45 -0
  41. package/mjs/src/lib/types/query-type.js.map +1 -0
  42. package/mjs/src/lib/types/response-body.d.ts +53 -0
  43. package/mjs/src/lib/types/response-body.js +2 -0
  44. package/mjs/src/lib/types/response-body.js.map +1 -0
  45. package/mjs/src/lib/utils/index.d.ts +1 -0
  46. package/mjs/src/lib/utils/index.js +2 -0
  47. package/mjs/src/lib/utils/index.js.map +1 -0
  48. package/mjs/src/lib/utils/object-utils.d.ts +10 -0
  49. package/mjs/src/lib/utils/object-utils.js +39 -0
  50. package/mjs/src/lib/utils/object-utils.js.map +1 -0
  51. package/package.json +43 -0
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@klerick/json-api-nestjs-shared",
3
+ "version": "1.0.0-beta.1",
4
+ "license": "MIT",
5
+ "private": false,
6
+ "contributors": [
7
+ {
8
+ "email": "klerick666@gmain.com",
9
+ "name": "Aleksandr Kharkovey"
10
+ }
11
+ ],
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/klerick/nestjs-json-api.git"
15
+ },
16
+ "engines": {
17
+ "node": ">= 20.0.0"
18
+ },
19
+ "description": "Shared Helper for JsonApi Plugin for NestJs",
20
+ "keywords": [
21
+ "nestjs",
22
+ "nest",
23
+ "jsonapi",
24
+ "json-api",
25
+ "typeorm",
26
+ "microorm",
27
+ "CRUD"
28
+ ],
29
+ "dependencies": {
30
+ "change-case-commonjs": "^5.4.4",
31
+ "reflect-metadata": "^0.1.12 || ^0.2.0",
32
+ "rxjs": "^7.1.0",
33
+ "ts-toolbelt": "^9.6.0",
34
+ "tslib": ">2.3.0"
35
+ },
36
+ "type": "commonjs",
37
+ "main": "./cjs/src/index.js",
38
+ "types": "./cjs/src/index.d.ts",
39
+ "module": "./mjs/src/index.js",
40
+ "publishConfig": {
41
+ "access": "public"
42
+ }
43
+ }
@@ -0,0 +1,3 @@
1
+ export * from './lib/utils';
2
+ export * from './lib/types';
3
+ export * from './lib/constants';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./lib/utils"), exports);
5
+ tslib_1.__exportStar(require("./lib/types"), exports);
6
+ tslib_1.__exportStar(require("./lib/constants"), exports);
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/json-api/json-api-nestjs-shared/src/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,sDAA4B;AAC5B,0DAAgC"}
@@ -0,0 +1,2 @@
1
+ export declare const KEY_MAIN_INPUT_SCHEMA = "atomic:operations";
2
+ export declare const KEY_MAIN_OUTPUT_SCHEMA = "atomic:results";
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KEY_MAIN_OUTPUT_SCHEMA = exports.KEY_MAIN_INPUT_SCHEMA = void 0;
4
+ exports.KEY_MAIN_INPUT_SCHEMA = 'atomic:operations';
5
+ exports.KEY_MAIN_OUTPUT_SCHEMA = 'atomic:results';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../libs/json-api/json-api-nestjs-shared/src/lib/constants/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,qBAAqB,GAAG,mBAAmB,CAAC;AAC5C,QAAA,sBAAsB,GAAG,gBAAgB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { Any } from 'ts-toolbelt';
2
+ export type HasId<T, IdKey extends string> = Any.At<T, IdKey> extends undefined ? 0 : 1;
3
+ export type CastIteratorType<T> = T extends {
4
+ [Symbol.iterator](): Iterator<infer U>;
5
+ } ? U : T;
6
+ type RelationCheck<T, IdKey extends string> = T extends never ? 0 : T extends Promise<infer U> ? HasId<U, IdKey> : HasId<CastIteratorType<T>, IdKey>;
7
+ export type RelationKeys<E, IdKey extends string = 'id'> = {
8
+ [K in keyof E]: Exclude<E[K], null> extends never ? never : RelationCheck<Exclude<E[K], null>, IdKey> extends 1 ? K : never;
9
+ }[keyof E];
10
+ export type PropertyKeys<E, IdKey extends string = 'id'> = keyof Omit<E, RelationKeys<E, IdKey>>;
11
+ export type IsIterator<T> = T extends {
12
+ [Symbol.iterator](): Iterator<any>;
13
+ } ? 1 : 0;
14
+ export type TypeOfArray<T> = T extends (infer U)[] ? U : T;
15
+ export type ValueOf<T> = T[keyof T];
16
+ export type Constructor<T> = new (...args: any[]) => T;
17
+ export type AnyEntity<T = object> = T;
18
+ export type EntityClass<T extends AnyEntity> = Constructor<T>;
19
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=entity-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-type.js","sourceRoot":"","sources":["../../../../../../../../libs/json-api/json-api-nestjs-shared/src/lib/types/entity-type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export * from './query-type';
2
+ export * from './entity-type';
3
+ export * from './response-body';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./query-type"), exports);
5
+ tslib_1.__exportStar(require("./entity-type"), exports);
6
+ tslib_1.__exportStar(require("./response-body"), exports);
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../libs/json-api/json-api-nestjs-shared/src/lib/types/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,wDAA8B;AAC9B,0DAAgC"}
@@ -0,0 +1,39 @@
1
+ export declare enum QueryField {
2
+ filter = "filter",
3
+ sort = "sort",
4
+ include = "include",
5
+ page = "page",
6
+ fields = "fields"
7
+ }
8
+ export declare enum FilterOperand {
9
+ eq = "eq",
10
+ gt = "gt",
11
+ gte = "gte",
12
+ like = "like",
13
+ lt = "lt",
14
+ lte = "lte",
15
+ ne = "ne",
16
+ regexp = "regexp",
17
+ in = "in",
18
+ nin = "nin",
19
+ some = "some"
20
+ }
21
+ export declare enum FilterOperandOnlyInNin {
22
+ in = "in",
23
+ nin = "nin"
24
+ }
25
+ export declare enum FilterOperandOnlySimple {
26
+ eq = "eq",
27
+ gt = "gt",
28
+ gte = "gte",
29
+ like = "like",
30
+ lt = "lt",
31
+ lte = "lte",
32
+ ne = "ne",
33
+ regexp = "regexp"
34
+ }
35
+ export declare enum Operation {
36
+ add = "add",
37
+ update = "update",
38
+ remove = "remove"
39
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Operation = exports.FilterOperandOnlySimple = exports.FilterOperandOnlyInNin = exports.FilterOperand = exports.QueryField = void 0;
4
+ var QueryField;
5
+ (function (QueryField) {
6
+ QueryField["filter"] = "filter";
7
+ QueryField["sort"] = "sort";
8
+ QueryField["include"] = "include";
9
+ QueryField["page"] = "page";
10
+ QueryField["fields"] = "fields";
11
+ })(QueryField || (exports.QueryField = QueryField = {}));
12
+ var FilterOperand;
13
+ (function (FilterOperand) {
14
+ FilterOperand["eq"] = "eq";
15
+ FilterOperand["gt"] = "gt";
16
+ FilterOperand["gte"] = "gte";
17
+ FilterOperand["like"] = "like";
18
+ FilterOperand["lt"] = "lt";
19
+ FilterOperand["lte"] = "lte";
20
+ FilterOperand["ne"] = "ne";
21
+ FilterOperand["regexp"] = "regexp";
22
+ FilterOperand["in"] = "in";
23
+ FilterOperand["nin"] = "nin";
24
+ FilterOperand["some"] = "some";
25
+ })(FilterOperand || (exports.FilterOperand = FilterOperand = {}));
26
+ var FilterOperandOnlyInNin;
27
+ (function (FilterOperandOnlyInNin) {
28
+ FilterOperandOnlyInNin["in"] = "in";
29
+ FilterOperandOnlyInNin["nin"] = "nin";
30
+ })(FilterOperandOnlyInNin || (exports.FilterOperandOnlyInNin = FilterOperandOnlyInNin = {}));
31
+ var FilterOperandOnlySimple;
32
+ (function (FilterOperandOnlySimple) {
33
+ FilterOperandOnlySimple["eq"] = "eq";
34
+ FilterOperandOnlySimple["gt"] = "gt";
35
+ FilterOperandOnlySimple["gte"] = "gte";
36
+ FilterOperandOnlySimple["like"] = "like";
37
+ FilterOperandOnlySimple["lt"] = "lt";
38
+ FilterOperandOnlySimple["lte"] = "lte";
39
+ FilterOperandOnlySimple["ne"] = "ne";
40
+ FilterOperandOnlySimple["regexp"] = "regexp";
41
+ })(FilterOperandOnlySimple || (exports.FilterOperandOnlySimple = FilterOperandOnlySimple = {}));
42
+ var Operation;
43
+ (function (Operation) {
44
+ Operation["add"] = "add";
45
+ Operation["update"] = "update";
46
+ Operation["remove"] = "remove";
47
+ })(Operation || (exports.Operation = Operation = {}));
48
+ //# sourceMappingURL=query-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-type.js","sourceRoot":"","sources":["../../../../../../../../libs/json-api/json-api-nestjs-shared/src/lib/types/query-type.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,+BAAiB,CAAA;IACjB,2BAAa,CAAA;IACb,iCAAmB,CAAA;IACnB,2BAAa,CAAA;IACb,+BAAiB,CAAA;AACnB,CAAC,EANW,UAAU,0BAAV,UAAU,QAMrB;AAED,IAAY,aAYX;AAZD,WAAY,aAAa;IACvB,0BAAS,CAAA;IACT,0BAAS,CAAA;IACT,4BAAW,CAAA;IACX,8BAAa,CAAA;IACb,0BAAS,CAAA;IACT,4BAAW,CAAA;IACX,0BAAS,CAAA;IACT,kCAAiB,CAAA;IACjB,0BAAS,CAAA;IACT,4BAAW,CAAA;IACX,8BAAa,CAAA;AACf,CAAC,EAZW,aAAa,6BAAb,aAAa,QAYxB;AAED,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAChC,mCAAS,CAAA;IACT,qCAAW,CAAA;AACb,CAAC,EAHW,sBAAsB,sCAAtB,sBAAsB,QAGjC;AACD,IAAY,uBASX;AATD,WAAY,uBAAuB;IACjC,oCAAS,CAAA;IACT,oCAAS,CAAA;IACT,sCAAW,CAAA;IACX,wCAAa,CAAA;IACb,oCAAS,CAAA;IACT,sCAAW,CAAA;IACX,oCAAS,CAAA;IACT,4CAAiB,CAAA;AACnB,CAAC,EATW,uBAAuB,uCAAvB,uBAAuB,QASlC;AAED,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,8BAAiB,CAAA;IACjB,8BAAiB,CAAA;AACnB,CAAC,EAJW,SAAS,yBAAT,SAAS,QAIpB"}
@@ -0,0 +1,53 @@
1
+ import { PropertyKeys, RelationKeys, IsIterator, CastIteratorType } from './entity-type';
2
+ import { ValueOf } from './entity-type';
3
+ export type DebugMetaProps = Partial<{
4
+ time: number;
5
+ }>;
6
+ export type PageProps = {
7
+ totalItems: number;
8
+ pageNumber: number;
9
+ pageSize: number;
10
+ };
11
+ export type MainData<T = string> = {
12
+ type: T;
13
+ id: string;
14
+ };
15
+ export type BaseMainData<Entity, IdKey extends string, Rel extends RelationKeys<Entity, IdKey>> = {
16
+ data: IsIterator<Entity[Rel]> extends 1 ? MainData[] : [Extract<Entity[Rel], null>] extends [never] ? MainData : MainData | null;
17
+ };
18
+ export type MetaProps<T, R = null> = R extends null ? T : T & R;
19
+ export type MetaPropsForArrayResourceObject = MetaProps<PageProps, DebugMetaProps>;
20
+ export type Links = {
21
+ self: string;
22
+ };
23
+ export type BaseLinks = {
24
+ links: Links;
25
+ };
26
+ export type Attributes<Entity extends object, IdKey extends string = 'id'> = {
27
+ [P in Exclude<PropertyKeys<Entity>, IdKey>]?: Entity[P];
28
+ };
29
+ export type BaseAttribute<Entity extends object, IdKey extends string = 'id'> = {
30
+ attributes?: Attributes<Entity, IdKey>;
31
+ };
32
+ export type Relationships<Entity extends object, IdKey extends string = 'id'> = {
33
+ [P in RelationKeys<Entity, IdKey>]?: BaseLinks | (BaseLinks & BaseMainData<Entity, IdKey, P>);
34
+ };
35
+ export type BaseRelationships<Entity extends object, IdKey extends string = 'id'> = {
36
+ relationships?: Relationships<Entity, IdKey>;
37
+ };
38
+ export type Meta<Type extends 'object' | 'array', ExtendBase> = Type extends 'array' ? MetaProps<MetaPropsForArrayResourceObject, ExtendBase> : MetaProps<DebugMetaProps, ExtendBase>;
39
+ export type BaseMeta<Type extends 'object' | 'array' = 'object', ExtendBase = null> = {
40
+ meta: Meta<Type, ExtendBase>;
41
+ };
42
+ export type BaseResourceData<Entity extends object, Type extends 'object' | 'array' = 'object', IdKey extends string = 'id'> = {
43
+ data: Type extends 'array' ? ResourceData<Entity, IdKey>[] : ResourceData<Entity, IdKey>;
44
+ };
45
+ export type Include<Entity, IdKey extends string = 'id'> = ValueOf<{
46
+ [Rel in RelationKeys<Entity, IdKey>]: CastIteratorType<Entity[Rel]> extends object ? ResourceData<CastIteratorType<Entity[Rel]>> : never;
47
+ }>;
48
+ export type BaseIncluded<Entity extends object, IdKey extends string = 'id'> = {
49
+ included?: Include<Entity, IdKey>[];
50
+ };
51
+ export type ResourceData<Entity extends object, IdKey extends string = 'id'> = MainData & BaseAttribute<Entity, IdKey> & BaseRelationships<Entity, IdKey> & BaseLinks;
52
+ export type ResourceObject<Entity extends object, Type extends 'object' | 'array' = 'object', ExtendBase = null, IdKey extends string = 'id'> = BaseMeta<Type, ExtendBase> & BaseResourceData<Entity, Type, IdKey> & BaseIncluded<Entity, IdKey>;
53
+ export type ResourceObjectRelationships<Entity extends object, IdKey extends string, Rel extends RelationKeys<Entity, IdKey>> = BaseMeta & BaseMainData<Entity, IdKey, Rel>;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=response-body.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response-body.js","sourceRoot":"","sources":["../../../../../../../../libs/json-api/json-api-nestjs-shared/src/lib/types/response-body.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export * from './object-utils';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./object-utils"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../libs/json-api/json-api-nestjs-shared/src/lib/utils/index.ts"],"names":[],"mappings":";;;AAAA,yDAA+B"}
@@ -0,0 +1,10 @@
1
+ export declare const ObjectTyped: {
2
+ keys: <T extends {}>(yourObject: T) => Array<keyof T>;
3
+ values: <U extends {}>(yourObject: U) => Array<U[keyof U]>;
4
+ entries: <O extends {}>(yourObject: O) => Array<[keyof O, O[keyof O]]>;
5
+ fromEntries: <K extends string, V>(yourObjectEntries: [K, V][]) => Record<K, V>;
6
+ };
7
+ export declare function isObject(item: unknown): item is object;
8
+ export declare function isString<T, P extends T>(value: T): value is P;
9
+ export declare function createEntityInstance<E>(name: string): E;
10
+ export declare const getEntityName: (entity: unknown) => string;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEntityName = exports.ObjectTyped = void 0;
4
+ exports.isObject = isObject;
5
+ exports.isString = isString;
6
+ exports.createEntityInstance = createEntityInstance;
7
+ const change_case_commonjs_1 = require("change-case-commonjs");
8
+ exports.ObjectTyped = {
9
+ keys: Object.keys,
10
+ values: Object.values,
11
+ entries: Object.entries,
12
+ fromEntries: Object.fromEntries,
13
+ };
14
+ function isObject(item) {
15
+ return typeof item === 'object' && !Array.isArray(item) && item !== null;
16
+ }
17
+ function isString(value) {
18
+ return typeof value === 'string' || value instanceof String;
19
+ }
20
+ function createEntityInstance(name) {
21
+ const entityName = (0, change_case_commonjs_1.pascalCase)(name);
22
+ return Function('return new class ' + entityName + '{}')();
23
+ }
24
+ const getEntityName = (entity) => {
25
+ if (entity === null)
26
+ throw new Error('Entity is null');
27
+ if (typeof entity === 'string') {
28
+ return entity;
29
+ }
30
+ if (typeof entity === 'object' && 'name' in entity) {
31
+ return `${entity['name']}`;
32
+ }
33
+ if (typeof entity === 'object' &&
34
+ 'constructor' in entity &&
35
+ 'name' in entity.constructor) {
36
+ return entity['constructor']['name'];
37
+ }
38
+ if (typeof entity === 'function' &&
39
+ 'constructor' in entity.prototype &&
40
+ 'name' in entity.prototype.constructor) {
41
+ return entity.prototype.constructor.name;
42
+ }
43
+ throw new Error('Entity is not object');
44
+ };
45
+ exports.getEntityName = getEntityName;
46
+ //# sourceMappingURL=object-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-utils.js","sourceRoot":"","sources":["../../../../../../../../libs/json-api/json-api-nestjs-shared/src/lib/utils/object-utils.ts"],"names":[],"mappings":";;;AAaA,4BAEC;AAED,4BAEC;AAED,oDAGC;AAxBD,+DAAkD;AAErC,QAAA,WAAW,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC,IAAuD;IACpE,MAAM,EAAE,MAAM,CAAC,MAA4D;IAC3E,OAAO,EAAE,MAAM,CAAC,OAEiB;IACjC,WAAW,EAAE,MAAM,CAAC,WAEH;CAClB,CAAC;AAEF,SAAgB,QAAQ,CAAC,IAAa;IACpC,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,IAAI,CAAC;AAC3E,CAAC;AAED,SAAgB,QAAQ,CAAiB,KAAQ;IAC/C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,CAAC;AAC9D,CAAC;AAED,SAAgB,oBAAoB,CAAI,IAAY;IAClD,MAAM,UAAU,GAAG,IAAA,iCAAU,EAAC,IAAI,CAAC,CAAC;IACpC,OAAO,QAAQ,CAAC,mBAAmB,GAAG,UAAU,GAAG,IAAI,CAAC,EAAE,CAAC;AAC7D,CAAC;AAEM,MAAM,aAAa,GAAG,CAAC,MAAe,EAAU,EAAE;IACvD,IAAI,MAAM,KAAK,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAEvD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;QACnD,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;IAC7B,CAAC;IAED,IACE,OAAO,MAAM,KAAK,QAAQ;QAC1B,aAAa,IAAI,MAAM;QACvB,MAAM,IAAI,MAAM,CAAC,WAAW,EAC5B,CAAC;QACD,OAAO,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IAED,IACE,OAAO,MAAM,KAAK,UAAU;QAC5B,aAAa,IAAI,MAAM,CAAC,SAAS;QACjC,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,WAAW,EACtC,CAAC;QACD,OAAO,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC;IAC3C,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;AAC1C,CAAC,CAAC;AA5BW,QAAA,aAAa,iBA4BxB"}
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@klerick/json-api-nestjs-shared",
3
+ "version": "1.0.0-beta.1",
4
+ "license": "MIT",
5
+ "private": false,
6
+ "contributors": [
7
+ {
8
+ "email": "klerick666@gmain.com",
9
+ "name": "Aleksandr Kharkovey"
10
+ }
11
+ ],
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/klerick/nestjs-json-api.git"
15
+ },
16
+ "engines": {
17
+ "node": ">= 20.0.0"
18
+ },
19
+ "description": "Shared Helper for JsonApi Plugin for NestJs",
20
+ "keywords": [
21
+ "nestjs",
22
+ "nest",
23
+ "jsonapi",
24
+ "json-api",
25
+ "typeorm",
26
+ "microorm",
27
+ "CRUD"
28
+ ],
29
+ "dependencies": {
30
+ "tslib": ">2.3.0",
31
+ "reflect-metadata": "^0.1.12 || ^0.2.0",
32
+ "rxjs": "^7.1.0"
33
+ },
34
+ "type": "commonjs",
35
+ "main": "./cjs/src/index.js",
36
+ "types": "./cjs/src/index.d.ts",
37
+ "module": "./mjs/src/index.js",
38
+ "publishConfig": {
39
+ "access": "public"
40
+ }
41
+ }
@@ -0,0 +1,3 @@
1
+ export * from './lib/utils';
2
+ export * from './lib/types';
3
+ export * from './lib/constants';
@@ -0,0 +1,4 @@
1
+ export * from './lib/utils';
2
+ export * from './lib/types';
3
+ export * from './lib/constants';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/json-api/json-api-nestjs-shared/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const KEY_MAIN_INPUT_SCHEMA = "atomic:operations";
2
+ export declare const KEY_MAIN_OUTPUT_SCHEMA = "atomic:results";
@@ -0,0 +1,3 @@
1
+ export const KEY_MAIN_INPUT_SCHEMA = 'atomic:operations';
2
+ export const KEY_MAIN_OUTPUT_SCHEMA = 'atomic:results';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../libs/json-api/json-api-nestjs-shared/src/lib/constants/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CAAC;AACzD,MAAM,CAAC,MAAM,sBAAsB,GAAG,gBAAgB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { Any } from 'ts-toolbelt';
2
+ export type HasId<T, IdKey extends string> = Any.At<T, IdKey> extends undefined ? 0 : 1;
3
+ export type CastIteratorType<T> = T extends {
4
+ [Symbol.iterator](): Iterator<infer U>;
5
+ } ? U : T;
6
+ type RelationCheck<T, IdKey extends string> = T extends never ? 0 : T extends Promise<infer U> ? HasId<U, IdKey> : HasId<CastIteratorType<T>, IdKey>;
7
+ export type RelationKeys<E, IdKey extends string = 'id'> = {
8
+ [K in keyof E]: Exclude<E[K], null> extends never ? never : RelationCheck<Exclude<E[K], null>, IdKey> extends 1 ? K : never;
9
+ }[keyof E];
10
+ export type PropertyKeys<E, IdKey extends string = 'id'> = keyof Omit<E, RelationKeys<E, IdKey>>;
11
+ export type IsIterator<T> = T extends {
12
+ [Symbol.iterator](): Iterator<any>;
13
+ } ? 1 : 0;
14
+ export type TypeOfArray<T> = T extends (infer U)[] ? U : T;
15
+ export type ValueOf<T> = T[keyof T];
16
+ export type Constructor<T> = new (...args: any[]) => T;
17
+ export type AnyEntity<T = object> = T;
18
+ export type EntityClass<T extends AnyEntity> = Constructor<T>;
19
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=entity-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-type.js","sourceRoot":"","sources":["../../../../../../../../libs/json-api/json-api-nestjs-shared/src/lib/types/entity-type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export * from './query-type';
2
+ export * from './entity-type';
3
+ export * from './response-body';
@@ -0,0 +1,4 @@
1
+ export * from './query-type';
2
+ export * from './entity-type';
3
+ export * from './response-body';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../libs/json-api/json-api-nestjs-shared/src/lib/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,39 @@
1
+ export declare enum QueryField {
2
+ filter = "filter",
3
+ sort = "sort",
4
+ include = "include",
5
+ page = "page",
6
+ fields = "fields"
7
+ }
8
+ export declare enum FilterOperand {
9
+ eq = "eq",
10
+ gt = "gt",
11
+ gte = "gte",
12
+ like = "like",
13
+ lt = "lt",
14
+ lte = "lte",
15
+ ne = "ne",
16
+ regexp = "regexp",
17
+ in = "in",
18
+ nin = "nin",
19
+ some = "some"
20
+ }
21
+ export declare enum FilterOperandOnlyInNin {
22
+ in = "in",
23
+ nin = "nin"
24
+ }
25
+ export declare enum FilterOperandOnlySimple {
26
+ eq = "eq",
27
+ gt = "gt",
28
+ gte = "gte",
29
+ like = "like",
30
+ lt = "lt",
31
+ lte = "lte",
32
+ ne = "ne",
33
+ regexp = "regexp"
34
+ }
35
+ export declare enum Operation {
36
+ add = "add",
37
+ update = "update",
38
+ remove = "remove"
39
+ }
@@ -0,0 +1,45 @@
1
+ export var QueryField;
2
+ (function (QueryField) {
3
+ QueryField["filter"] = "filter";
4
+ QueryField["sort"] = "sort";
5
+ QueryField["include"] = "include";
6
+ QueryField["page"] = "page";
7
+ QueryField["fields"] = "fields";
8
+ })(QueryField || (QueryField = {}));
9
+ export var FilterOperand;
10
+ (function (FilterOperand) {
11
+ FilterOperand["eq"] = "eq";
12
+ FilterOperand["gt"] = "gt";
13
+ FilterOperand["gte"] = "gte";
14
+ FilterOperand["like"] = "like";
15
+ FilterOperand["lt"] = "lt";
16
+ FilterOperand["lte"] = "lte";
17
+ FilterOperand["ne"] = "ne";
18
+ FilterOperand["regexp"] = "regexp";
19
+ FilterOperand["in"] = "in";
20
+ FilterOperand["nin"] = "nin";
21
+ FilterOperand["some"] = "some";
22
+ })(FilterOperand || (FilterOperand = {}));
23
+ export var FilterOperandOnlyInNin;
24
+ (function (FilterOperandOnlyInNin) {
25
+ FilterOperandOnlyInNin["in"] = "in";
26
+ FilterOperandOnlyInNin["nin"] = "nin";
27
+ })(FilterOperandOnlyInNin || (FilterOperandOnlyInNin = {}));
28
+ export var FilterOperandOnlySimple;
29
+ (function (FilterOperandOnlySimple) {
30
+ FilterOperandOnlySimple["eq"] = "eq";
31
+ FilterOperandOnlySimple["gt"] = "gt";
32
+ FilterOperandOnlySimple["gte"] = "gte";
33
+ FilterOperandOnlySimple["like"] = "like";
34
+ FilterOperandOnlySimple["lt"] = "lt";
35
+ FilterOperandOnlySimple["lte"] = "lte";
36
+ FilterOperandOnlySimple["ne"] = "ne";
37
+ FilterOperandOnlySimple["regexp"] = "regexp";
38
+ })(FilterOperandOnlySimple || (FilterOperandOnlySimple = {}));
39
+ export var Operation;
40
+ (function (Operation) {
41
+ Operation["add"] = "add";
42
+ Operation["update"] = "update";
43
+ Operation["remove"] = "remove";
44
+ })(Operation || (Operation = {}));
45
+ //# sourceMappingURL=query-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-type.js","sourceRoot":"","sources":["../../../../../../../../libs/json-api/json-api-nestjs-shared/src/lib/types/query-type.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,+BAAiB,CAAA;IACjB,2BAAa,CAAA;IACb,iCAAmB,CAAA;IACnB,2BAAa,CAAA;IACb,+BAAiB,CAAA;AACnB,CAAC,EANW,UAAU,KAAV,UAAU,QAMrB;AAED,MAAM,CAAN,IAAY,aAYX;AAZD,WAAY,aAAa;IACvB,0BAAS,CAAA;IACT,0BAAS,CAAA;IACT,4BAAW,CAAA;IACX,8BAAa,CAAA;IACb,0BAAS,CAAA;IACT,4BAAW,CAAA;IACX,0BAAS,CAAA;IACT,kCAAiB,CAAA;IACjB,0BAAS,CAAA;IACT,4BAAW,CAAA;IACX,8BAAa,CAAA;AACf,CAAC,EAZW,aAAa,KAAb,aAAa,QAYxB;AAED,MAAM,CAAN,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAChC,mCAAS,CAAA;IACT,qCAAW,CAAA;AACb,CAAC,EAHW,sBAAsB,KAAtB,sBAAsB,QAGjC;AACD,MAAM,CAAN,IAAY,uBASX;AATD,WAAY,uBAAuB;IACjC,oCAAS,CAAA;IACT,oCAAS,CAAA;IACT,sCAAW,CAAA;IACX,wCAAa,CAAA;IACb,oCAAS,CAAA;IACT,sCAAW,CAAA;IACX,oCAAS,CAAA;IACT,4CAAiB,CAAA;AACnB,CAAC,EATW,uBAAuB,KAAvB,uBAAuB,QASlC;AAED,MAAM,CAAN,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,8BAAiB,CAAA;IACjB,8BAAiB,CAAA;AACnB,CAAC,EAJW,SAAS,KAAT,SAAS,QAIpB"}
@@ -0,0 +1,53 @@
1
+ import { PropertyKeys, RelationKeys, IsIterator, CastIteratorType } from './entity-type';
2
+ import { ValueOf } from './entity-type';
3
+ export type DebugMetaProps = Partial<{
4
+ time: number;
5
+ }>;
6
+ export type PageProps = {
7
+ totalItems: number;
8
+ pageNumber: number;
9
+ pageSize: number;
10
+ };
11
+ export type MainData<T = string> = {
12
+ type: T;
13
+ id: string;
14
+ };
15
+ export type BaseMainData<Entity, IdKey extends string, Rel extends RelationKeys<Entity, IdKey>> = {
16
+ data: IsIterator<Entity[Rel]> extends 1 ? MainData[] : [Extract<Entity[Rel], null>] extends [never] ? MainData : MainData | null;
17
+ };
18
+ export type MetaProps<T, R = null> = R extends null ? T : T & R;
19
+ export type MetaPropsForArrayResourceObject = MetaProps<PageProps, DebugMetaProps>;
20
+ export type Links = {
21
+ self: string;
22
+ };
23
+ export type BaseLinks = {
24
+ links: Links;
25
+ };
26
+ export type Attributes<Entity extends object, IdKey extends string = 'id'> = {
27
+ [P in Exclude<PropertyKeys<Entity>, IdKey>]?: Entity[P];
28
+ };
29
+ export type BaseAttribute<Entity extends object, IdKey extends string = 'id'> = {
30
+ attributes?: Attributes<Entity, IdKey>;
31
+ };
32
+ export type Relationships<Entity extends object, IdKey extends string = 'id'> = {
33
+ [P in RelationKeys<Entity, IdKey>]?: BaseLinks | (BaseLinks & BaseMainData<Entity, IdKey, P>);
34
+ };
35
+ export type BaseRelationships<Entity extends object, IdKey extends string = 'id'> = {
36
+ relationships?: Relationships<Entity, IdKey>;
37
+ };
38
+ export type Meta<Type extends 'object' | 'array', ExtendBase> = Type extends 'array' ? MetaProps<MetaPropsForArrayResourceObject, ExtendBase> : MetaProps<DebugMetaProps, ExtendBase>;
39
+ export type BaseMeta<Type extends 'object' | 'array' = 'object', ExtendBase = null> = {
40
+ meta: Meta<Type, ExtendBase>;
41
+ };
42
+ export type BaseResourceData<Entity extends object, Type extends 'object' | 'array' = 'object', IdKey extends string = 'id'> = {
43
+ data: Type extends 'array' ? ResourceData<Entity, IdKey>[] : ResourceData<Entity, IdKey>;
44
+ };
45
+ export type Include<Entity, IdKey extends string = 'id'> = ValueOf<{
46
+ [Rel in RelationKeys<Entity, IdKey>]: CastIteratorType<Entity[Rel]> extends object ? ResourceData<CastIteratorType<Entity[Rel]>> : never;
47
+ }>;
48
+ export type BaseIncluded<Entity extends object, IdKey extends string = 'id'> = {
49
+ included?: Include<Entity, IdKey>[];
50
+ };
51
+ export type ResourceData<Entity extends object, IdKey extends string = 'id'> = MainData & BaseAttribute<Entity, IdKey> & BaseRelationships<Entity, IdKey> & BaseLinks;
52
+ export type ResourceObject<Entity extends object, Type extends 'object' | 'array' = 'object', ExtendBase = null, IdKey extends string = 'id'> = BaseMeta<Type, ExtendBase> & BaseResourceData<Entity, Type, IdKey> & BaseIncluded<Entity, IdKey>;
53
+ export type ResourceObjectRelationships<Entity extends object, IdKey extends string, Rel extends RelationKeys<Entity, IdKey>> = BaseMeta & BaseMainData<Entity, IdKey, Rel>;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=response-body.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response-body.js","sourceRoot":"","sources":["../../../../../../../../libs/json-api/json-api-nestjs-shared/src/lib/types/response-body.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export * from './object-utils';
@@ -0,0 +1,2 @@
1
+ export * from './object-utils';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../libs/json-api/json-api-nestjs-shared/src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare const ObjectTyped: {
2
+ keys: <T extends {}>(yourObject: T) => Array<keyof T>;
3
+ values: <U extends {}>(yourObject: U) => Array<U[keyof U]>;
4
+ entries: <O extends {}>(yourObject: O) => Array<[keyof O, O[keyof O]]>;
5
+ fromEntries: <K extends string, V>(yourObjectEntries: [K, V][]) => Record<K, V>;
6
+ };
7
+ export declare function isObject(item: unknown): item is object;
8
+ export declare function isString<T, P extends T>(value: T): value is P;
9
+ export declare function createEntityInstance<E>(name: string): E;
10
+ export declare const getEntityName: (entity: unknown) => string;
@@ -0,0 +1,39 @@
1
+ import { pascalCase } from 'change-case-commonjs';
2
+ export const ObjectTyped = {
3
+ keys: Object.keys,
4
+ values: Object.values,
5
+ entries: Object.entries,
6
+ fromEntries: Object.fromEntries,
7
+ };
8
+ export function isObject(item) {
9
+ return typeof item === 'object' && !Array.isArray(item) && item !== null;
10
+ }
11
+ export function isString(value) {
12
+ return typeof value === 'string' || value instanceof String;
13
+ }
14
+ export function createEntityInstance(name) {
15
+ const entityName = pascalCase(name);
16
+ return Function('return new class ' + entityName + '{}')();
17
+ }
18
+ export const getEntityName = (entity) => {
19
+ if (entity === null)
20
+ throw new Error('Entity is null');
21
+ if (typeof entity === 'string') {
22
+ return entity;
23
+ }
24
+ if (typeof entity === 'object' && 'name' in entity) {
25
+ return `${entity['name']}`;
26
+ }
27
+ if (typeof entity === 'object' &&
28
+ 'constructor' in entity &&
29
+ 'name' in entity.constructor) {
30
+ return entity['constructor']['name'];
31
+ }
32
+ if (typeof entity === 'function' &&
33
+ 'constructor' in entity.prototype &&
34
+ 'name' in entity.prototype.constructor) {
35
+ return entity.prototype.constructor.name;
36
+ }
37
+ throw new Error('Entity is not object');
38
+ };
39
+ //# sourceMappingURL=object-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-utils.js","sourceRoot":"","sources":["../../../../../../../../libs/json-api/json-api-nestjs-shared/src/lib/utils/object-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC,IAAuD;IACpE,MAAM,EAAE,MAAM,CAAC,MAA4D;IAC3E,OAAO,EAAE,MAAM,CAAC,OAEiB;IACjC,WAAW,EAAE,MAAM,CAAC,WAEH;CAClB,CAAC;AAEF,MAAM,UAAU,QAAQ,CAAC,IAAa;IACpC,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,IAAI,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,QAAQ,CAAiB,KAAQ;IAC/C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAI,IAAY;IAClD,MAAM,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IACpC,OAAO,QAAQ,CAAC,mBAAmB,GAAG,UAAU,GAAG,IAAI,CAAC,EAAE,CAAC;AAC7D,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAe,EAAU,EAAE;IACvD,IAAI,MAAM,KAAK,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAEvD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;QACnD,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;IAC7B,CAAC;IAED,IACE,OAAO,MAAM,KAAK,QAAQ;QAC1B,aAAa,IAAI,MAAM;QACvB,MAAM,IAAI,MAAM,CAAC,WAAW,EAC5B,CAAC;QACD,OAAO,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IAED,IACE,OAAO,MAAM,KAAK,UAAU;QAC5B,aAAa,IAAI,MAAM,CAAC,SAAS;QACjC,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,WAAW,EACtC,CAAC;QACD,OAAO,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC;IAC3C,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;AAC1C,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@klerick/json-api-nestjs-shared",
3
+ "version": "1.0.0-beta.1",
4
+ "license": "MIT",
5
+ "private": false,
6
+ "contributors": [
7
+ {
8
+ "email": "klerick666@gmain.com",
9
+ "name": "Aleksandr Kharkovey"
10
+ }
11
+ ],
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/klerick/nestjs-json-api.git"
15
+ },
16
+ "engines": {
17
+ "node": ">= 20.0.0"
18
+ },
19
+ "description": "Shared Helper for JsonApi Plugin for NestJs",
20
+ "keywords": [
21
+ "nestjs",
22
+ "nest",
23
+ "jsonapi",
24
+ "json-api",
25
+ "typeorm",
26
+ "microorm",
27
+ "CRUD"
28
+ ],
29
+ "dependencies": {
30
+ "change-case-commonjs": "^5.4.4",
31
+ "reflect-metadata": "^0.1.12 || ^0.2.0",
32
+ "rxjs": "^7.1.0",
33
+ "ts-toolbelt": "^9.6.0",
34
+ "tslib": ">2.3.0"
35
+ },
36
+ "type": "commonjs",
37
+ "main": "./cjs/src/index.js",
38
+ "types": "./cjs/src/index.d.ts",
39
+ "module": "./mjs/src/index.js",
40
+ "publishConfig": {
41
+ "access": "public"
42
+ }
43
+ }