@izara_frontend/service-schemas 1.0.1 → 1.0.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/index.js ADDED
@@ -0,0 +1,14 @@
1
+ // Re-export selected public API from the src implementation
2
+ export {
3
+ initGetSchemaTools,
4
+ getObjectSchemaWithAllHierarchy,
5
+ getObjectLinks,
6
+ getRequiredOnCreateLinks,
7
+ getRelationshipSchema,
8
+ getObjSchemaWithOutHierarchy,
9
+ getObjSchemaWithHierarchy,
10
+ getObjSchemaCombineFieldNames,
11
+ getLinkConfig,
12
+ getObjectLinksWithRequestProperties,
13
+ collectObjectLinksWithRequestProperties
14
+ } from "./src/getObjectSchema";
package/package.json CHANGED
@@ -1,30 +1,27 @@
1
1
  {
2
2
  "name": "@izara_frontend/service-schemas",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
- "main": "./dist/serviceSchemas.js",
5
+ "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1",
8
- "build": "webpack"
8
+ "build": ""
9
9
  },
10
10
  "author": "",
11
11
  "license": "ISC",
12
12
  "publishConfig": {
13
13
  "access": "public"
14
14
  },
15
+ "type": "module",
15
16
  "homepage": "https://bitbucket.org/izarafrontends/izara-frontend-lib-core-service-schemas",
16
- "devDependencies": {
17
- "@babel/core": "^7.26.10",
18
- "@babel/plugin-proposal-class-properties": "^7.18.6",
19
- "@babel/plugin-transform-runtime": "^7.26.10",
20
- "@babel/preset-env": "^7.26.9",
21
- "@babel/preset-react": "^7.26.3",
22
- "@babel/preset-stage-0": "^7.8.3",
23
- "@babel/runtime": "^7.27.6",
24
- "babel-loader": "^8.2.2",
25
- "babel-preset-react": "^6.24.1",
26
- "path": "^0.12.7",
27
- "webpack": "^5.99.5",
28
- "webpack-cli": "^6.0.1"
17
+ "peerDependencies": {
18
+ "react": "^18.3.1",
19
+ "react-dom": "^18.3.1"
20
+ },
21
+ "devDependencies": {},
22
+ "dependencies": {
23
+ "@izara_project/izara-shared-core": "^1.0.6",
24
+ "@izara_project/izara-shared-service-schemas": "^1.0.33",
25
+ "lodash": "^4.17.21"
29
26
  }
30
- }
27
+ }
@@ -0,0 +1,121 @@
1
+ import { consts, utils } from "@izara_project/izara-shared-service-schemas";
2
+ const { SCHEMA_NAME_PER_S3_PATH, SCHEMA_NAME } = consts;
3
+
4
+ const BUCKET_NAME = `object-schema`;
5
+ const BUCKET_URL = `https://${BUCKET_NAME}.s3.us-east-2.amazonaws.com/`;
6
+
7
+
8
+ export const getObjectSchemaAllEndpoint = {
9
+ name: "getObjectSchemaAll",
10
+ type: "query",
11
+ query: {
12
+ keepUnusedDataFor: Infinity,
13
+ query: (objType) => {
14
+
15
+ const s3Key = SCHEMA_NAME_PER_S3_PATH[SCHEMA_NAME.objectSchemaAll](objType);
16
+ const s3Url = `${BUCKET_URL}${s3Key.result}`;
17
+
18
+ return {
19
+ url: s3Url,
20
+ };
21
+ },
22
+ }
23
+ }
24
+
25
+ export const getRelationshipSchemaEndpoint = {
26
+ name: "getRelationshipSchema",
27
+ type: "query",
28
+ query: {
29
+ keepUnusedDataFor: Infinity,
30
+ query: (relType) => {
31
+
32
+ const s3Key = SCHEMA_NAME_PER_S3_PATH[SCHEMA_NAME.relationshipSchema](relType);
33
+ const s3Url = `${BUCKET_URL}${s3Key.result}`;
34
+
35
+ return {
36
+ url: s3Url,
37
+ };
38
+ },
39
+ }
40
+ }
41
+
42
+ export const getObjectLinksEndpoint = {
43
+ name: "getObjectLinks",
44
+ type: "query",
45
+ query: {
46
+ keepUnusedDataFor: Infinity,
47
+ query: (relType) => {
48
+
49
+ const s3Key = SCHEMA_NAME_PER_S3_PATH[SCHEMA_NAME.objectRelationship](relType);
50
+ const s3Url = `${BUCKET_URL}${s3Key.result}`;
51
+
52
+ return {
53
+ url: s3Url,
54
+ };
55
+ },
56
+ }
57
+ }
58
+
59
+ export const getRefObjectRelationshipEndpoint = {
60
+ name: "getRefObjectRelationship",
61
+ type: "query",
62
+ query: {
63
+ keepUnusedDataFor: Infinity,
64
+ query: (objType) => {
65
+
66
+ const s3Key = SCHEMA_NAME_PER_S3_PATH[SCHEMA_NAME.refObjectRelationship](objType);
67
+ const s3Url = `${BUCKET_URL}${s3Key.result}`;
68
+
69
+ return {
70
+ url: s3Url,
71
+ };
72
+ },
73
+ }
74
+ }
75
+
76
+
77
+ export const getLinkConfigEndpoint = {
78
+ name: "getLinkConfig",
79
+ type: "query",
80
+ query: {
81
+ keepUnusedDataFor: Infinity,
82
+ query: ({ firstObjType, secondObjType, relType, direction }) => {
83
+ const linkTypeId = utils.createLinkTypeId(firstObjType, secondObjType, relType, direction);
84
+ const s3Key = SCHEMA_NAME_PER_S3_PATH[SCHEMA_NAME.linkByLinkTypeId](
85
+ {
86
+ serviceTag: relType.serviceTag,
87
+ linkTypeId: linkTypeId.result
88
+ }
89
+ );
90
+
91
+ const s3Url = `${BUCKET_URL}${s3Key.result}`;
92
+
93
+ return {
94
+ url: s3Url,
95
+ };
96
+ },
97
+ // add custom cacheKey?
98
+ serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {
99
+ const { firstObjType, secondObjType, relType, direction } = queryArgs;
100
+ const linkTypeId = utils.createLinkTypeId(firstObjType, secondObjType, relType, direction);
101
+ return `${endpointName}_${linkTypeId.result}`;
102
+ }
103
+
104
+ }
105
+ }
106
+
107
+
108
+
109
+ // getObjectSchemaAll: builder.query({
110
+ // keepUnusedDataFor: Infinity,
111
+
112
+ // query: (objType) => {
113
+
114
+ // const s3Key = SCHEMA_NAME_PER_S3_PATH[SCHEMA_NAME.objectSchemaAll](objType);
115
+ // const s3Url = `${BUCKET_URL}${s3Key.result}`;
116
+
117
+ // return {
118
+ // url: s3Url,
119
+ // };
120
+ // },
121
+ // }),