@edraj/tsdmart 2.8.0 → 3.0.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.
Files changed (2) hide show
  1. package/dmart.service.ts +16 -18
  2. package/package.json +1 -1
package/dmart.service.ts CHANGED
@@ -5,7 +5,6 @@ import {
5
5
  ApiQueryResponse,
6
6
  ApiResponse,
7
7
  ConfirmOTPRequest,
8
- ContentType,
9
8
  headers,
10
9
  LoginResponse,
11
10
  PasswordResetRequest,
@@ -275,29 +274,28 @@ export class Dmart {
275
274
  }
276
275
 
277
276
 
278
-
279
277
  public static async upload_with_payload(
280
- space_name: string,
281
- subpath: string,
282
- shortname: string,
283
- resource_type: ResourceType,
284
- payload_file: File,
285
- content_type?: ContentType,
286
- schema_shortname?: string,
287
- scope: string = "managed"
288
- ): Promise<ApiResponse> {
278
+ space_name: string,
279
+ subpath: string,
280
+ shortname: string,
281
+ resource_type: ResourceType,
282
+ payload_file: File,
283
+ attributes?: Record<string, any>|null,
284
+ scope: string = "managed"
285
+ ) {
289
286
  const request_record_body: any = {
290
287
  resource_type,
291
288
  subpath,
292
289
  shortname,
293
- attributes: { is_active: true, payload: { body: {} } },
290
+ attributes: attributes,
294
291
  };
295
- if (content_type) {
296
- request_record_body.attributes.payload.content_type = content_type;
297
- }
298
- if (schema_shortname) {
299
- request_record_body.attributes.payload.schema_shortname =
300
- schema_shortname;
292
+
293
+ if (attributes !== null && Object.keys(attributes!).length === 0) {
294
+ request_record_body.attributes = {is_active: true, payload: { body: {} }};
295
+ } else {
296
+ if(!Object.keys(attributes!).includes('is_active')){
297
+ request_record_body.attributes.is_active = true;
298
+ }
301
299
  }
302
300
 
303
301
  const request_record = new Blob([JSON.stringify(request_record_body)], {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edraj/tsdmart",
3
- "version": "2.8.0",
3
+ "version": "3.0.0",
4
4
  "description": "A TypeScript implementation of the Dmart that depends on axios.",
5
5
  "author": "Kefah T. Issa",
6
6
  "email": "kefah.issa@gmail.com",