@fraym/crud 0.11.0 → 0.12.0

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.
@@ -2,7 +2,7 @@ import { ClientConfig } from "../config/config";
2
2
  import { CreatedCrudData } from "./create";
3
3
  import { Filter, GetCrudDataList } from "./getDataList";
4
4
  export interface DeliveryClient {
5
- create: (tenantId: string, type: string, data: Record<string, any>) => Promise<CreatedCrudData>;
5
+ create: (tenantId: string, type: string, data: Record<string, any>, id?: string) => Promise<CreatedCrudData>;
6
6
  update: (tenantId: string, type: string, id: string, data: Record<string, any>) => Promise<void>;
7
7
  delete: (tenantId: string, type: string, id: string) => Promise<void>;
8
8
  getData: <T extends {}>(tenantId: string, type: string, id: string, returnEmptyDataIfNotFound?: boolean) => Promise<T>;
@@ -16,8 +16,8 @@ const newDeliveryClient = async (config) => {
16
16
  "grpc.keepalive_timeout_ms": config.keepaliveTimeout,
17
17
  "grpc.keepalive_permit_without_calls": 1,
18
18
  });
19
- const create = async (tenantId, type, data) => {
20
- return await (0, create_1.createCrudData)(tenantId, type, data, serviceClient);
19
+ const create = async (tenantId, type, data, id = "") => {
20
+ return await (0, create_1.createCrudData)(tenantId, type, data, id, serviceClient);
21
21
  };
22
22
  const update = async (tenantId, type, id, data) => {
23
23
  return await (0, update_1.updateCrudData)(tenantId, type, id, data, serviceClient);
@@ -2,4 +2,4 @@ import { DeliveryServiceClient } from "@fraym/crud-proto";
2
2
  export interface CreatedCrudData {
3
3
  id: string;
4
4
  }
5
- export declare const createCrudData: (tenantId: string, type: string, data: Record<string, any>, serviceClient: DeliveryServiceClient) => Promise<CreatedCrudData>;
5
+ export declare const createCrudData: (tenantId: string, type: string, data: Record<string, any>, id: string, serviceClient: DeliveryServiceClient) => Promise<CreatedCrudData>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createCrudData = void 0;
4
- const createCrudData = async (tenantId, type, data, serviceClient) => {
4
+ const createCrudData = async (tenantId, type, data, id, serviceClient) => {
5
5
  const requestData = {};
6
6
  for (const key in data) {
7
7
  if (typeof data[key] === "string") {
@@ -16,6 +16,7 @@ const createCrudData = async (tenantId, type, data, serviceClient) => {
16
16
  tenantId,
17
17
  type,
18
18
  data: requestData,
19
+ id,
19
20
  }, (error, response) => {
20
21
  if (error) {
21
22
  reject(error.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fraym/crud",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "license": "UNLICENSED",
5
5
  "homepage": "https://github.com/fraym/crud-nodejs",
6
6
  "repository": {
@@ -27,10 +27,10 @@
27
27
  "crud": "dist/cmd/crud.js"
28
28
  },
29
29
  "dependencies": {
30
- "@fraym/crud-proto": "1.0.0-alpha.8",
30
+ "@fraym/crud-proto": "1.0.0-alpha.11",
31
31
  "@graphql-tools/graphql-file-loader": "^7.5.14",
32
32
  "@graphql-tools/load": "^7.8.9",
33
- "@grpc/grpc-js": "1.7.2",
33
+ "@grpc/grpc-js": "^1.8.7",
34
34
  "dotenv": "^16.0.3",
35
35
  "graphql": "^16.6.0",
36
36
  "yargs": "^17.6.2"