@commercelayer/provisioning-sdk 2.0.0-beta.4 → 2.0.0-beta.6

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/lib/index.d.mts CHANGED
@@ -200,10 +200,30 @@ type VersionRel = ResourceRel & {
200
200
  type VersionSort = Pick<Version, 'id'> & ResourceSort;
201
201
  interface Version extends Resource {
202
202
  readonly type: VersionType;
203
+ /**
204
+ * The type of the versioned resource..
205
+ * @example ```"roles"```
206
+ */
203
207
  resource_type: string;
208
+ /**
209
+ * The versioned resource ID..
210
+ * @example ```"PzdJhdLdYV"```
211
+ */
204
212
  resource_id: string;
213
+ /**
214
+ * The event which generates the version..
215
+ * @example ```"update"```
216
+ */
205
217
  event: string;
218
+ /**
219
+ * The object changes payload..
220
+ * @example ```"[object Object]"```
221
+ */
206
222
  changes: Record<string, any>;
223
+ /**
224
+ * Information about who triggered the change, only showed when it's from a JWT token..
225
+ * @example ```"[object Object]"```
226
+ */
207
227
  who: Record<string, any>;
208
228
  }
209
229
  declare class Versions extends ApiResource<Version> {
@@ -224,28 +244,74 @@ type RoleRel$4 = ResourceRel & {
224
244
  type PermissionSort = Pick<Permission, 'id'> & ResourceSort;
225
245
  interface Permission extends Resource {
226
246
  readonly type: PermissionType;
247
+ /**
248
+ * Determines if the permission have access to create rights..
249
+ */
227
250
  can_create: boolean;
251
+ /**
252
+ * Determines if the permission have access to read rights..
253
+ */
228
254
  can_read: boolean;
255
+ /**
256
+ * Determines if the permission have access to update rights..
257
+ */
229
258
  can_update: boolean;
259
+ /**
260
+ * Determines if the permission have access to destroy rights..
261
+ */
230
262
  can_destroy: boolean;
263
+ /**
264
+ * The resource where this permission is applied..
265
+ */
231
266
  subject: string;
267
+ /**
268
+ * An object that contains additional restrictions..
269
+ * @example ```"[object Object]"```
270
+ */
232
271
  restrictions: Record<string, any>;
233
272
  organization?: Nullable<Organization>;
234
273
  role?: Nullable<Role>;
235
274
  versions?: Nullable<Version[]>;
236
275
  }
237
276
  interface PermissionCreate extends ResourceCreate {
277
+ /**
278
+ * Determines if the permission have access to create rights..
279
+ */
238
280
  can_create: boolean;
281
+ /**
282
+ * Determines if the permission have access to read rights..
283
+ */
239
284
  can_read: boolean;
285
+ /**
286
+ * Determines if the permission have access to update rights..
287
+ */
240
288
  can_update: boolean;
289
+ /**
290
+ * Determines if the permission have access to destroy rights..
291
+ */
241
292
  can_destroy: boolean;
293
+ /**
294
+ * The resource where this permission is applied..
295
+ */
242
296
  subject: string;
243
297
  role: RoleRel$4;
244
298
  }
245
299
  interface PermissionUpdate extends ResourceUpdate {
300
+ /**
301
+ * Determines if the permission have access to create rights..
302
+ */
246
303
  can_create?: Nullable<boolean>;
304
+ /**
305
+ * Determines if the permission have access to read rights..
306
+ */
247
307
  can_read?: Nullable<boolean>;
308
+ /**
309
+ * Determines if the permission have access to update rights..
310
+ */
248
311
  can_update?: Nullable<boolean>;
312
+ /**
313
+ * Determines if the permission have access to destroy rights..
314
+ */
249
315
  can_destroy?: Nullable<boolean>;
250
316
  }
251
317
  declare class Permissions extends ApiResource<Permission> {
@@ -271,7 +337,15 @@ type OrganizationRel$4 = ResourceRel & {
271
337
  type RoleSort = Pick<Role, 'id'> & ResourceSort;
272
338
  interface Role extends Resource {
273
339
  readonly type: RoleType;
340
+ /**
341
+ * The role name..
342
+ * @example ```"Custom role"```
343
+ */
274
344
  name: string;
345
+ /**
346
+ * The kind of role, one of: `custom`, `admin`, `read_only`.
347
+ * @example ```"custom"```
348
+ */
275
349
  kind: string;
276
350
  organization?: Nullable<Organization>;
277
351
  permissions?: Nullable<Permission[]>;
@@ -280,10 +354,18 @@ interface Role extends Resource {
280
354
  versions?: Nullable<Version[]>;
281
355
  }
282
356
  interface RoleCreate extends ResourceCreate {
357
+ /**
358
+ * The role name..
359
+ * @example ```"Custom role"```
360
+ */
283
361
  name: string;
284
362
  organization: OrganizationRel$4;
285
363
  }
286
364
  interface RoleUpdate extends ResourceUpdate {
365
+ /**
366
+ * The role name..
367
+ * @example ```"Custom role"```
368
+ */
287
369
  name?: Nullable<string>;
288
370
  }
289
371
  declare class Roles extends ApiResource<Role> {
@@ -320,6 +402,10 @@ type RoleRel$2 = ResourceRel & {
320
402
  type ApplicationMembershipSort = Pick<ApplicationMembership, 'id'> & ResourceSort;
321
403
  interface ApplicationMembership extends Resource {
322
404
  readonly type: ApplicationMembershipType;
405
+ /**
406
+ * Set of key-value pairs that contains restrictions and scopes of the application membership..
407
+ * @example ```"[object Object]"```
408
+ */
323
409
  filters?: Nullable<Record<string, any>>;
324
410
  api_credential?: Nullable<ApiCredential>;
325
411
  membership?: Nullable<Membership>;
@@ -327,6 +413,10 @@ interface ApplicationMembership extends Resource {
327
413
  role?: Nullable<Role>;
328
414
  }
329
415
  interface ApplicationMembershipCreate extends ResourceCreate {
416
+ /**
417
+ * Set of key-value pairs that contains restrictions and scopes of the application membership..
418
+ * @example ```"[object Object]"```
419
+ */
330
420
  filters?: Nullable<Record<string, any>>;
331
421
  api_credential: ApiCredentialRel$1;
332
422
  membership: MembershipRel$1;
@@ -334,6 +424,10 @@ interface ApplicationMembershipCreate extends ResourceCreate {
334
424
  role: RoleRel$2;
335
425
  }
336
426
  interface ApplicationMembershipUpdate extends ResourceUpdate {
427
+ /**
428
+ * Set of key-value pairs that contains restrictions and scopes of the application membership..
429
+ * @example ```"[object Object]"```
430
+ */
337
431
  filters?: Nullable<Record<string, any>>;
338
432
  role?: Nullable<RoleRel$2>;
339
433
  }
@@ -365,13 +459,33 @@ type RoleRel$1 = ResourceRel & {
365
459
  type ApplicationMembershipRel = ResourceRel & {
366
460
  type: ApplicationMembershipType;
367
461
  };
368
- type MembershipSort = Pick<Membership, 'id'> & ResourceSort;
462
+ type MembershipSort = Pick<Membership, 'id' | 'status'> & ResourceSort;
369
463
  interface Membership extends Resource {
370
464
  readonly type: MembershipType;
465
+ /**
466
+ * The user email..
467
+ * @example ```"commercelayer@commercelayer.io"```
468
+ */
371
469
  user_email: string;
470
+ /**
471
+ * The user first name..
472
+ * @example ```"John"```
473
+ */
372
474
  user_first_name: string;
475
+ /**
476
+ * The user last name..
477
+ * @example ```"Doe"```
478
+ */
373
479
  user_last_name: string;
480
+ /**
481
+ * The memberships status. One of `pending` (default), `active`..
482
+ * @example ```"pending"```
483
+ */
374
484
  status: 'pending' | 'active';
485
+ /**
486
+ * Indicates if the user it's the owner of the organization..
487
+ * @example ```"true"```
488
+ */
375
489
  owner: boolean;
376
490
  organization?: Nullable<Organization>;
377
491
  role?: Nullable<Role>;
@@ -379,6 +493,10 @@ interface Membership extends Resource {
379
493
  versions?: Nullable<Version[]>;
380
494
  }
381
495
  interface MembershipCreate extends ResourceCreate {
496
+ /**
497
+ * The user email..
498
+ * @example ```"commercelayer@commercelayer.io"```
499
+ */
382
500
  user_email: string;
383
501
  organization: OrganizationRel$2;
384
502
  role: RoleRel$1;
@@ -411,25 +529,101 @@ type OrganizationRel$1 = ResourceRel & {
411
529
  type OrganizationSort = Pick<Organization, 'id'> & ResourceSort;
412
530
  interface Organization extends Resource {
413
531
  readonly type: OrganizationType;
532
+ /**
533
+ * The organization's internal name..
534
+ * @example ```"The Blue Brand"```
535
+ */
414
536
  name: string;
537
+ /**
538
+ * The organization's slug name..
539
+ * @example ```"the-blue-brand"```
540
+ */
415
541
  slug: string;
542
+ /**
543
+ * The organization's domain..
544
+ * @example ```"the-blue-brand.commercelayer.io"```
545
+ */
416
546
  domain: string;
547
+ /**
548
+ * The organization's configuration..
549
+ * @example ```"[object Object]"```
550
+ */
417
551
  config?: Nullable<Record<string, any>>;
552
+ /**
553
+ * The organization's support phone..
554
+ * @example ```"+01 30800857"```
555
+ */
418
556
  support_phone?: Nullable<string>;
557
+ /**
558
+ * The organization's support email..
559
+ * @example ```"support@bluebrand.com"```
560
+ */
419
561
  support_email?: Nullable<string>;
562
+ /**
563
+ * The URL to the organization's logo..
564
+ * @example ```"https://bluebrand.com/img/logo.svg"```
565
+ */
420
566
  logo_url?: Nullable<string>;
567
+ /**
568
+ * The URL to the organization's favicon..
569
+ * @example ```"https://bluebrand.com/img/favicon.ico"```
570
+ */
421
571
  favicon_url?: Nullable<string>;
572
+ /**
573
+ * The organization's primary color. Format is HEX (starts with `#` and it's followed by six letters and/or numbers)..
574
+ * @example ```"#C8984E"```
575
+ */
422
576
  primary_color?: Nullable<string>;
577
+ /**
578
+ * The organization's contrast color. Format is HEX (starts with `#` and it's followed by six letters and/or numbers)..
579
+ * @example ```"#FFFFCC"```
580
+ */
423
581
  contrast_color?: Nullable<string>;
582
+ /**
583
+ * The organization's Google Tag Manager ID..
584
+ * @example ```"GTM-5FJXX6"```
585
+ */
424
586
  gtm_id?: Nullable<string>;
587
+ /**
588
+ * The organization's Google Tag Manager ID for test..
589
+ * @example ```"GTM-5FJXX7"```
590
+ */
425
591
  gtm_id_test?: Nullable<string>;
592
+ /**
593
+ * Indicates if organization has discount disabled..
594
+ */
426
595
  discount_disabled?: Nullable<boolean>;
596
+ /**
597
+ * Indicates if organization has account disabled..
598
+ */
427
599
  account_disabled?: Nullable<boolean>;
600
+ /**
601
+ * Indicates if organization has acceptance disabled..
602
+ */
428
603
  acceptance_disabled?: Nullable<boolean>;
604
+ /**
605
+ * The maximum number of active concurrent promotions allowed for your organization..
606
+ * @example ```"10"```
607
+ */
429
608
  max_concurrent_promotions: number;
609
+ /**
610
+ * The maximum number of concurrent imports allowed for your organization..
611
+ * @example ```"30"```
612
+ */
430
613
  max_concurrent_imports: number;
614
+ /**
615
+ * The region where the organization it's located, default value it's `eu-west-1`..
616
+ * @example ```"eu-west-1"```
617
+ */
431
618
  region?: Nullable<string>;
619
+ /**
620
+ * Indicates if the organization can switch to live mode..
621
+ */
432
622
  can_switch_live: boolean;
623
+ /**
624
+ * Information about the current subscription such as the plan type, limits and subscription totals counter..
625
+ * @example ```"[object Object]"```
626
+ */
433
627
  subscription_info: Record<string, any>;
434
628
  memberships?: Nullable<Membership[]>;
435
629
  roles?: Nullable<Role[]>;
@@ -437,34 +631,136 @@ interface Organization extends Resource {
437
631
  api_credentials?: Nullable<ApiCredential[]>;
438
632
  }
439
633
  interface OrganizationCreate extends ResourceCreate {
634
+ /**
635
+ * The organization's internal name..
636
+ * @example ```"The Blue Brand"```
637
+ */
440
638
  name: string;
639
+ /**
640
+ * The organization's configuration..
641
+ * @example ```"[object Object]"```
642
+ */
441
643
  config?: Nullable<Record<string, any>>;
644
+ /**
645
+ * The organization's support phone..
646
+ * @example ```"+01 30800857"```
647
+ */
442
648
  support_phone?: Nullable<string>;
649
+ /**
650
+ * The organization's support email..
651
+ * @example ```"support@bluebrand.com"```
652
+ */
443
653
  support_email?: Nullable<string>;
654
+ /**
655
+ * The URL to the organization's logo..
656
+ * @example ```"https://bluebrand.com/img/logo.svg"```
657
+ */
444
658
  logo_url?: Nullable<string>;
659
+ /**
660
+ * The URL to the organization's favicon..
661
+ * @example ```"https://bluebrand.com/img/favicon.ico"```
662
+ */
445
663
  favicon_url?: Nullable<string>;
664
+ /**
665
+ * The organization's primary color. Format is HEX (starts with `#` and it's followed by six letters and/or numbers)..
666
+ * @example ```"#C8984E"```
667
+ */
446
668
  primary_color?: Nullable<string>;
669
+ /**
670
+ * The organization's contrast color. Format is HEX (starts with `#` and it's followed by six letters and/or numbers)..
671
+ * @example ```"#FFFFCC"```
672
+ */
447
673
  contrast_color?: Nullable<string>;
674
+ /**
675
+ * The organization's Google Tag Manager ID..
676
+ * @example ```"GTM-5FJXX6"```
677
+ */
448
678
  gtm_id?: Nullable<string>;
679
+ /**
680
+ * The organization's Google Tag Manager ID for test..
681
+ * @example ```"GTM-5FJXX7"```
682
+ */
449
683
  gtm_id_test?: Nullable<string>;
684
+ /**
685
+ * Indicates if organization has discount disabled..
686
+ */
450
687
  discount_disabled?: Nullable<boolean>;
688
+ /**
689
+ * Indicates if organization has account disabled..
690
+ */
451
691
  account_disabled?: Nullable<boolean>;
692
+ /**
693
+ * Indicates if organization has acceptance disabled..
694
+ */
452
695
  acceptance_disabled?: Nullable<boolean>;
696
+ /**
697
+ * The region where the organization it's located, default value it's `eu-west-1`..
698
+ * @example ```"eu-west-1"```
699
+ */
453
700
  region?: Nullable<string>;
454
701
  }
455
702
  interface OrganizationUpdate extends ResourceUpdate {
703
+ /**
704
+ * The organization's internal name..
705
+ * @example ```"The Blue Brand"```
706
+ */
456
707
  name?: Nullable<string>;
708
+ /**
709
+ * The organization's configuration..
710
+ * @example ```"[object Object]"```
711
+ */
457
712
  config?: Nullable<Record<string, any>>;
713
+ /**
714
+ * The organization's support phone..
715
+ * @example ```"+01 30800857"```
716
+ */
458
717
  support_phone?: Nullable<string>;
718
+ /**
719
+ * The organization's support email..
720
+ * @example ```"support@bluebrand.com"```
721
+ */
459
722
  support_email?: Nullable<string>;
723
+ /**
724
+ * The URL to the organization's logo..
725
+ * @example ```"https://bluebrand.com/img/logo.svg"```
726
+ */
460
727
  logo_url?: Nullable<string>;
728
+ /**
729
+ * The URL to the organization's favicon..
730
+ * @example ```"https://bluebrand.com/img/favicon.ico"```
731
+ */
461
732
  favicon_url?: Nullable<string>;
733
+ /**
734
+ * The organization's primary color. Format is HEX (starts with `#` and it's followed by six letters and/or numbers)..
735
+ * @example ```"#C8984E"```
736
+ */
462
737
  primary_color?: Nullable<string>;
738
+ /**
739
+ * The organization's contrast color. Format is HEX (starts with `#` and it's followed by six letters and/or numbers)..
740
+ * @example ```"#FFFFCC"```
741
+ */
463
742
  contrast_color?: Nullable<string>;
743
+ /**
744
+ * The organization's Google Tag Manager ID..
745
+ * @example ```"GTM-5FJXX6"```
746
+ */
464
747
  gtm_id?: Nullable<string>;
748
+ /**
749
+ * The organization's Google Tag Manager ID for test..
750
+ * @example ```"GTM-5FJXX7"```
751
+ */
465
752
  gtm_id_test?: Nullable<string>;
753
+ /**
754
+ * Indicates if organization has discount disabled..
755
+ */
466
756
  discount_disabled?: Nullable<boolean>;
757
+ /**
758
+ * Indicates if organization has account disabled..
759
+ */
467
760
  account_disabled?: Nullable<boolean>;
761
+ /**
762
+ * Indicates if organization has acceptance disabled..
763
+ */
468
764
  acceptance_disabled?: Nullable<boolean>;
469
765
  }
470
766
  declare class Organizations extends ApiResource<Organization> {
@@ -501,32 +797,106 @@ type RoleRel = ResourceRel & {
501
797
  type ApiCredentialSort = Pick<ApiCredential, 'id' | 'mode'> & ResourceSort;
502
798
  interface ApiCredential extends Resource {
503
799
  readonly type: ApiCredentialType;
800
+ /**
801
+ * The API credential internal name..
802
+ * @example ```"My app"```
803
+ */
504
804
  name: string;
805
+ /**
806
+ * The API credential kind, can be one of: `webapp`, `sales_channel`, `integration` or the kind of app you want to fork (e.g. `orders`, `imports`, etc.)..
807
+ * @example ```"sales_channel"```
808
+ */
505
809
  kind: string;
810
+ /**
811
+ * Indicates if the API credential it's confidential..
812
+ * @example ```"true"```
813
+ */
506
814
  confidential: boolean;
815
+ /**
816
+ * The API credential redirect URI..
817
+ * @example ```"https://bluebrand.com/img/logo.svg"```
818
+ */
507
819
  redirect_uri?: Nullable<string>;
820
+ /**
821
+ * The API credential unique ID..
822
+ * @example ```"xxxx-yyyy-zzzz"```
823
+ */
508
824
  client_id: string;
825
+ /**
826
+ * The API credential unique secret..
827
+ * @example ```"xxxx-yyyy-zzzz"```
828
+ */
509
829
  client_secret: string;
830
+ /**
831
+ * The API credential scopes..
832
+ * @example ```"market:all market:9 market:122 market:6 stock_location:6 stock_location:33"```
833
+ */
510
834
  scopes: string;
835
+ /**
836
+ * The lifetime of the access token in seconds (min. `7200`, max. `31536000`. Default is `14400` for Sales channels and `7200` for other client types)..
837
+ * @example ```"7200"```
838
+ */
511
839
  expires_in?: Nullable<number>;
840
+ /**
841
+ * Indicates the environment the resource belongs to (one of `test` or `live`)..
842
+ * @example ```"test"```
843
+ */
512
844
  mode?: Nullable<string>;
845
+ /**
846
+ * Indicates if the API credential is used to create a custom app (e.g. fork a hosted app)..
847
+ */
513
848
  custom?: Nullable<boolean>;
514
849
  organization?: Nullable<Organization>;
515
850
  role?: Nullable<Role>;
516
851
  }
517
852
  interface ApiCredentialCreate extends ResourceCreate {
853
+ /**
854
+ * The API credential internal name..
855
+ * @example ```"My app"```
856
+ */
518
857
  name: string;
858
+ /**
859
+ * The API credential kind, can be one of: `webapp`, `sales_channel`, `integration` or the kind of app you want to fork (e.g. `orders`, `imports`, etc.)..
860
+ * @example ```"sales_channel"```
861
+ */
519
862
  kind: string;
863
+ /**
864
+ * The API credential redirect URI..
865
+ * @example ```"https://bluebrand.com/img/logo.svg"```
866
+ */
520
867
  redirect_uri?: Nullable<string>;
868
+ /**
869
+ * The lifetime of the access token in seconds (min. `7200`, max. `31536000`. Default is `14400` for Sales channels and `7200` for other client types)..
870
+ * @example ```"7200"```
871
+ */
521
872
  expires_in?: Nullable<number>;
873
+ /**
874
+ * Indicates the environment the resource belongs to (one of `test` or `live`)..
875
+ * @example ```"test"```
876
+ */
522
877
  mode?: Nullable<string>;
878
+ /**
879
+ * Indicates if the API credential is used to create a custom app (e.g. fork a hosted app)..
880
+ */
523
881
  custom?: Nullable<boolean>;
524
882
  organization: OrganizationRel;
525
883
  role?: Nullable<RoleRel>;
526
884
  }
527
885
  interface ApiCredentialUpdate extends ResourceUpdate {
886
+ /**
887
+ * The API credential internal name..
888
+ * @example ```"My app"```
889
+ */
528
890
  name?: Nullable<string>;
891
+ /**
892
+ * The API credential redirect URI..
893
+ * @example ```"https://bluebrand.com/img/logo.svg"```
894
+ */
529
895
  redirect_uri?: Nullable<string>;
896
+ /**
897
+ * The lifetime of the access token in seconds (min. `7200`, max. `31536000`. Default is `14400` for Sales channels and `7200` for other client types)..
898
+ * @example ```"7200"```
899
+ */
530
900
  expires_in?: Nullable<number>;
531
901
  role?: Nullable<RoleRel>;
532
902
  }
@@ -550,16 +920,51 @@ type UserRel = ResourceRel & {
550
920
  type UserSort = Pick<User, 'id'> & ResourceSort;
551
921
  interface User extends Resource {
552
922
  readonly type: UserType;
923
+ /**
924
+ * The user email..
925
+ * @example ```"user@commercelayer.io"```
926
+ */
553
927
  email: string;
928
+ /**
929
+ * The user first name..
930
+ * @example ```"John"```
931
+ */
554
932
  first_name: string;
933
+ /**
934
+ * The user last name..
935
+ * @example ```"Doe"```
936
+ */
555
937
  last_name: string;
938
+ /**
939
+ * The user preferred timezone..
940
+ * @example ```"UTC"```
941
+ */
556
942
  time_zone?: Nullable<string>;
943
+ /**
944
+ * The user 2FA setting..
945
+ */
557
946
  otp_required_for_login: boolean;
558
947
  }
559
948
  interface UserUpdate extends ResourceUpdate {
949
+ /**
950
+ * The user email..
951
+ * @example ```"user@commercelayer.io"```
952
+ */
560
953
  email?: Nullable<string>;
954
+ /**
955
+ * The user first name..
956
+ * @example ```"John"```
957
+ */
561
958
  first_name?: Nullable<string>;
959
+ /**
960
+ * The user last name..
961
+ * @example ```"Doe"```
962
+ */
562
963
  last_name?: Nullable<string>;
964
+ /**
965
+ * The user preferred timezone..
966
+ * @example ```"UTC"```
967
+ */
563
968
  time_zone?: Nullable<string>;
564
969
  }
565
970
  declare class Users extends ApiSingleton<User> {
@@ -623,11 +1028,11 @@ type ResourceSortFields = {
623
1028
  };
624
1029
 
625
1030
  declare enum ErrorType {
626
- CLIENT = "client",
627
- REQUEST = "request",
628
- RESPONSE = "response",
629
- CANCEL = "cancel",
630
- PARSE = "parse",
1031
+ CLIENT = "client",// Generic Client error
1032
+ REQUEST = "request",// Error preparing API request
1033
+ RESPONSE = "response",// Error response from API
1034
+ CANCEL = "cancel",// Forced request abort using interceptor
1035
+ PARSE = "parse",// Error parsing API resource
631
1036
  TIMEOUT = "timeout"
632
1037
  }
633
1038
  declare class SdkError extends Error {
package/lib/index.d.ts CHANGED
@@ -200,10 +200,30 @@ type VersionRel = ResourceRel & {
200
200
  type VersionSort = Pick<Version, 'id'> & ResourceSort;
201
201
  interface Version extends Resource {
202
202
  readonly type: VersionType;
203
+ /**
204
+ * The type of the versioned resource..
205
+ * @example ```"roles"```
206
+ */
203
207
  resource_type: string;
208
+ /**
209
+ * The versioned resource ID..
210
+ * @example ```"PzdJhdLdYV"```
211
+ */
204
212
  resource_id: string;
213
+ /**
214
+ * The event which generates the version..
215
+ * @example ```"update"```
216
+ */
205
217
  event: string;
218
+ /**
219
+ * The object changes payload..
220
+ * @example ```"[object Object]"```
221
+ */
206
222
  changes: Record<string, any>;
223
+ /**
224
+ * Information about who triggered the change, only showed when it's from a JWT token..
225
+ * @example ```"[object Object]"```
226
+ */
207
227
  who: Record<string, any>;
208
228
  }
209
229
  declare class Versions extends ApiResource<Version> {
@@ -224,28 +244,74 @@ type RoleRel$4 = ResourceRel & {
224
244
  type PermissionSort = Pick<Permission, 'id'> & ResourceSort;
225
245
  interface Permission extends Resource {
226
246
  readonly type: PermissionType;
247
+ /**
248
+ * Determines if the permission have access to create rights..
249
+ */
227
250
  can_create: boolean;
251
+ /**
252
+ * Determines if the permission have access to read rights..
253
+ */
228
254
  can_read: boolean;
255
+ /**
256
+ * Determines if the permission have access to update rights..
257
+ */
229
258
  can_update: boolean;
259
+ /**
260
+ * Determines if the permission have access to destroy rights..
261
+ */
230
262
  can_destroy: boolean;
263
+ /**
264
+ * The resource where this permission is applied..
265
+ */
231
266
  subject: string;
267
+ /**
268
+ * An object that contains additional restrictions..
269
+ * @example ```"[object Object]"```
270
+ */
232
271
  restrictions: Record<string, any>;
233
272
  organization?: Nullable<Organization>;
234
273
  role?: Nullable<Role>;
235
274
  versions?: Nullable<Version[]>;
236
275
  }
237
276
  interface PermissionCreate extends ResourceCreate {
277
+ /**
278
+ * Determines if the permission have access to create rights..
279
+ */
238
280
  can_create: boolean;
281
+ /**
282
+ * Determines if the permission have access to read rights..
283
+ */
239
284
  can_read: boolean;
285
+ /**
286
+ * Determines if the permission have access to update rights..
287
+ */
240
288
  can_update: boolean;
289
+ /**
290
+ * Determines if the permission have access to destroy rights..
291
+ */
241
292
  can_destroy: boolean;
293
+ /**
294
+ * The resource where this permission is applied..
295
+ */
242
296
  subject: string;
243
297
  role: RoleRel$4;
244
298
  }
245
299
  interface PermissionUpdate extends ResourceUpdate {
300
+ /**
301
+ * Determines if the permission have access to create rights..
302
+ */
246
303
  can_create?: Nullable<boolean>;
304
+ /**
305
+ * Determines if the permission have access to read rights..
306
+ */
247
307
  can_read?: Nullable<boolean>;
308
+ /**
309
+ * Determines if the permission have access to update rights..
310
+ */
248
311
  can_update?: Nullable<boolean>;
312
+ /**
313
+ * Determines if the permission have access to destroy rights..
314
+ */
249
315
  can_destroy?: Nullable<boolean>;
250
316
  }
251
317
  declare class Permissions extends ApiResource<Permission> {
@@ -271,7 +337,15 @@ type OrganizationRel$4 = ResourceRel & {
271
337
  type RoleSort = Pick<Role, 'id'> & ResourceSort;
272
338
  interface Role extends Resource {
273
339
  readonly type: RoleType;
340
+ /**
341
+ * The role name..
342
+ * @example ```"Custom role"```
343
+ */
274
344
  name: string;
345
+ /**
346
+ * The kind of role, one of: `custom`, `admin`, `read_only`.
347
+ * @example ```"custom"```
348
+ */
275
349
  kind: string;
276
350
  organization?: Nullable<Organization>;
277
351
  permissions?: Nullable<Permission[]>;
@@ -280,10 +354,18 @@ interface Role extends Resource {
280
354
  versions?: Nullable<Version[]>;
281
355
  }
282
356
  interface RoleCreate extends ResourceCreate {
357
+ /**
358
+ * The role name..
359
+ * @example ```"Custom role"```
360
+ */
283
361
  name: string;
284
362
  organization: OrganizationRel$4;
285
363
  }
286
364
  interface RoleUpdate extends ResourceUpdate {
365
+ /**
366
+ * The role name..
367
+ * @example ```"Custom role"```
368
+ */
287
369
  name?: Nullable<string>;
288
370
  }
289
371
  declare class Roles extends ApiResource<Role> {
@@ -320,6 +402,10 @@ type RoleRel$2 = ResourceRel & {
320
402
  type ApplicationMembershipSort = Pick<ApplicationMembership, 'id'> & ResourceSort;
321
403
  interface ApplicationMembership extends Resource {
322
404
  readonly type: ApplicationMembershipType;
405
+ /**
406
+ * Set of key-value pairs that contains restrictions and scopes of the application membership..
407
+ * @example ```"[object Object]"```
408
+ */
323
409
  filters?: Nullable<Record<string, any>>;
324
410
  api_credential?: Nullable<ApiCredential>;
325
411
  membership?: Nullable<Membership>;
@@ -327,6 +413,10 @@ interface ApplicationMembership extends Resource {
327
413
  role?: Nullable<Role>;
328
414
  }
329
415
  interface ApplicationMembershipCreate extends ResourceCreate {
416
+ /**
417
+ * Set of key-value pairs that contains restrictions and scopes of the application membership..
418
+ * @example ```"[object Object]"```
419
+ */
330
420
  filters?: Nullable<Record<string, any>>;
331
421
  api_credential: ApiCredentialRel$1;
332
422
  membership: MembershipRel$1;
@@ -334,6 +424,10 @@ interface ApplicationMembershipCreate extends ResourceCreate {
334
424
  role: RoleRel$2;
335
425
  }
336
426
  interface ApplicationMembershipUpdate extends ResourceUpdate {
427
+ /**
428
+ * Set of key-value pairs that contains restrictions and scopes of the application membership..
429
+ * @example ```"[object Object]"```
430
+ */
337
431
  filters?: Nullable<Record<string, any>>;
338
432
  role?: Nullable<RoleRel$2>;
339
433
  }
@@ -365,13 +459,33 @@ type RoleRel$1 = ResourceRel & {
365
459
  type ApplicationMembershipRel = ResourceRel & {
366
460
  type: ApplicationMembershipType;
367
461
  };
368
- type MembershipSort = Pick<Membership, 'id'> & ResourceSort;
462
+ type MembershipSort = Pick<Membership, 'id' | 'status'> & ResourceSort;
369
463
  interface Membership extends Resource {
370
464
  readonly type: MembershipType;
465
+ /**
466
+ * The user email..
467
+ * @example ```"commercelayer@commercelayer.io"```
468
+ */
371
469
  user_email: string;
470
+ /**
471
+ * The user first name..
472
+ * @example ```"John"```
473
+ */
372
474
  user_first_name: string;
475
+ /**
476
+ * The user last name..
477
+ * @example ```"Doe"```
478
+ */
373
479
  user_last_name: string;
480
+ /**
481
+ * The memberships status. One of `pending` (default), `active`..
482
+ * @example ```"pending"```
483
+ */
374
484
  status: 'pending' | 'active';
485
+ /**
486
+ * Indicates if the user it's the owner of the organization..
487
+ * @example ```"true"```
488
+ */
375
489
  owner: boolean;
376
490
  organization?: Nullable<Organization>;
377
491
  role?: Nullable<Role>;
@@ -379,6 +493,10 @@ interface Membership extends Resource {
379
493
  versions?: Nullable<Version[]>;
380
494
  }
381
495
  interface MembershipCreate extends ResourceCreate {
496
+ /**
497
+ * The user email..
498
+ * @example ```"commercelayer@commercelayer.io"```
499
+ */
382
500
  user_email: string;
383
501
  organization: OrganizationRel$2;
384
502
  role: RoleRel$1;
@@ -411,25 +529,101 @@ type OrganizationRel$1 = ResourceRel & {
411
529
  type OrganizationSort = Pick<Organization, 'id'> & ResourceSort;
412
530
  interface Organization extends Resource {
413
531
  readonly type: OrganizationType;
532
+ /**
533
+ * The organization's internal name..
534
+ * @example ```"The Blue Brand"```
535
+ */
414
536
  name: string;
537
+ /**
538
+ * The organization's slug name..
539
+ * @example ```"the-blue-brand"```
540
+ */
415
541
  slug: string;
542
+ /**
543
+ * The organization's domain..
544
+ * @example ```"the-blue-brand.commercelayer.io"```
545
+ */
416
546
  domain: string;
547
+ /**
548
+ * The organization's configuration..
549
+ * @example ```"[object Object]"```
550
+ */
417
551
  config?: Nullable<Record<string, any>>;
552
+ /**
553
+ * The organization's support phone..
554
+ * @example ```"+01 30800857"```
555
+ */
418
556
  support_phone?: Nullable<string>;
557
+ /**
558
+ * The organization's support email..
559
+ * @example ```"support@bluebrand.com"```
560
+ */
419
561
  support_email?: Nullable<string>;
562
+ /**
563
+ * The URL to the organization's logo..
564
+ * @example ```"https://bluebrand.com/img/logo.svg"```
565
+ */
420
566
  logo_url?: Nullable<string>;
567
+ /**
568
+ * The URL to the organization's favicon..
569
+ * @example ```"https://bluebrand.com/img/favicon.ico"```
570
+ */
421
571
  favicon_url?: Nullable<string>;
572
+ /**
573
+ * The organization's primary color. Format is HEX (starts with `#` and it's followed by six letters and/or numbers)..
574
+ * @example ```"#C8984E"```
575
+ */
422
576
  primary_color?: Nullable<string>;
577
+ /**
578
+ * The organization's contrast color. Format is HEX (starts with `#` and it's followed by six letters and/or numbers)..
579
+ * @example ```"#FFFFCC"```
580
+ */
423
581
  contrast_color?: Nullable<string>;
582
+ /**
583
+ * The organization's Google Tag Manager ID..
584
+ * @example ```"GTM-5FJXX6"```
585
+ */
424
586
  gtm_id?: Nullable<string>;
587
+ /**
588
+ * The organization's Google Tag Manager ID for test..
589
+ * @example ```"GTM-5FJXX7"```
590
+ */
425
591
  gtm_id_test?: Nullable<string>;
592
+ /**
593
+ * Indicates if organization has discount disabled..
594
+ */
426
595
  discount_disabled?: Nullable<boolean>;
596
+ /**
597
+ * Indicates if organization has account disabled..
598
+ */
427
599
  account_disabled?: Nullable<boolean>;
600
+ /**
601
+ * Indicates if organization has acceptance disabled..
602
+ */
428
603
  acceptance_disabled?: Nullable<boolean>;
604
+ /**
605
+ * The maximum number of active concurrent promotions allowed for your organization..
606
+ * @example ```"10"```
607
+ */
429
608
  max_concurrent_promotions: number;
609
+ /**
610
+ * The maximum number of concurrent imports allowed for your organization..
611
+ * @example ```"30"```
612
+ */
430
613
  max_concurrent_imports: number;
614
+ /**
615
+ * The region where the organization it's located, default value it's `eu-west-1`..
616
+ * @example ```"eu-west-1"```
617
+ */
431
618
  region?: Nullable<string>;
619
+ /**
620
+ * Indicates if the organization can switch to live mode..
621
+ */
432
622
  can_switch_live: boolean;
623
+ /**
624
+ * Information about the current subscription such as the plan type, limits and subscription totals counter..
625
+ * @example ```"[object Object]"```
626
+ */
433
627
  subscription_info: Record<string, any>;
434
628
  memberships?: Nullable<Membership[]>;
435
629
  roles?: Nullable<Role[]>;
@@ -437,34 +631,136 @@ interface Organization extends Resource {
437
631
  api_credentials?: Nullable<ApiCredential[]>;
438
632
  }
439
633
  interface OrganizationCreate extends ResourceCreate {
634
+ /**
635
+ * The organization's internal name..
636
+ * @example ```"The Blue Brand"```
637
+ */
440
638
  name: string;
639
+ /**
640
+ * The organization's configuration..
641
+ * @example ```"[object Object]"```
642
+ */
441
643
  config?: Nullable<Record<string, any>>;
644
+ /**
645
+ * The organization's support phone..
646
+ * @example ```"+01 30800857"```
647
+ */
442
648
  support_phone?: Nullable<string>;
649
+ /**
650
+ * The organization's support email..
651
+ * @example ```"support@bluebrand.com"```
652
+ */
443
653
  support_email?: Nullable<string>;
654
+ /**
655
+ * The URL to the organization's logo..
656
+ * @example ```"https://bluebrand.com/img/logo.svg"```
657
+ */
444
658
  logo_url?: Nullable<string>;
659
+ /**
660
+ * The URL to the organization's favicon..
661
+ * @example ```"https://bluebrand.com/img/favicon.ico"```
662
+ */
445
663
  favicon_url?: Nullable<string>;
664
+ /**
665
+ * The organization's primary color. Format is HEX (starts with `#` and it's followed by six letters and/or numbers)..
666
+ * @example ```"#C8984E"```
667
+ */
446
668
  primary_color?: Nullable<string>;
669
+ /**
670
+ * The organization's contrast color. Format is HEX (starts with `#` and it's followed by six letters and/or numbers)..
671
+ * @example ```"#FFFFCC"```
672
+ */
447
673
  contrast_color?: Nullable<string>;
674
+ /**
675
+ * The organization's Google Tag Manager ID..
676
+ * @example ```"GTM-5FJXX6"```
677
+ */
448
678
  gtm_id?: Nullable<string>;
679
+ /**
680
+ * The organization's Google Tag Manager ID for test..
681
+ * @example ```"GTM-5FJXX7"```
682
+ */
449
683
  gtm_id_test?: Nullable<string>;
684
+ /**
685
+ * Indicates if organization has discount disabled..
686
+ */
450
687
  discount_disabled?: Nullable<boolean>;
688
+ /**
689
+ * Indicates if organization has account disabled..
690
+ */
451
691
  account_disabled?: Nullable<boolean>;
692
+ /**
693
+ * Indicates if organization has acceptance disabled..
694
+ */
452
695
  acceptance_disabled?: Nullable<boolean>;
696
+ /**
697
+ * The region where the organization it's located, default value it's `eu-west-1`..
698
+ * @example ```"eu-west-1"```
699
+ */
453
700
  region?: Nullable<string>;
454
701
  }
455
702
  interface OrganizationUpdate extends ResourceUpdate {
703
+ /**
704
+ * The organization's internal name..
705
+ * @example ```"The Blue Brand"```
706
+ */
456
707
  name?: Nullable<string>;
708
+ /**
709
+ * The organization's configuration..
710
+ * @example ```"[object Object]"```
711
+ */
457
712
  config?: Nullable<Record<string, any>>;
713
+ /**
714
+ * The organization's support phone..
715
+ * @example ```"+01 30800857"```
716
+ */
458
717
  support_phone?: Nullable<string>;
718
+ /**
719
+ * The organization's support email..
720
+ * @example ```"support@bluebrand.com"```
721
+ */
459
722
  support_email?: Nullable<string>;
723
+ /**
724
+ * The URL to the organization's logo..
725
+ * @example ```"https://bluebrand.com/img/logo.svg"```
726
+ */
460
727
  logo_url?: Nullable<string>;
728
+ /**
729
+ * The URL to the organization's favicon..
730
+ * @example ```"https://bluebrand.com/img/favicon.ico"```
731
+ */
461
732
  favicon_url?: Nullable<string>;
733
+ /**
734
+ * The organization's primary color. Format is HEX (starts with `#` and it's followed by six letters and/or numbers)..
735
+ * @example ```"#C8984E"```
736
+ */
462
737
  primary_color?: Nullable<string>;
738
+ /**
739
+ * The organization's contrast color. Format is HEX (starts with `#` and it's followed by six letters and/or numbers)..
740
+ * @example ```"#FFFFCC"```
741
+ */
463
742
  contrast_color?: Nullable<string>;
743
+ /**
744
+ * The organization's Google Tag Manager ID..
745
+ * @example ```"GTM-5FJXX6"```
746
+ */
464
747
  gtm_id?: Nullable<string>;
748
+ /**
749
+ * The organization's Google Tag Manager ID for test..
750
+ * @example ```"GTM-5FJXX7"```
751
+ */
465
752
  gtm_id_test?: Nullable<string>;
753
+ /**
754
+ * Indicates if organization has discount disabled..
755
+ */
466
756
  discount_disabled?: Nullable<boolean>;
757
+ /**
758
+ * Indicates if organization has account disabled..
759
+ */
467
760
  account_disabled?: Nullable<boolean>;
761
+ /**
762
+ * Indicates if organization has acceptance disabled..
763
+ */
468
764
  acceptance_disabled?: Nullable<boolean>;
469
765
  }
470
766
  declare class Organizations extends ApiResource<Organization> {
@@ -501,32 +797,106 @@ type RoleRel = ResourceRel & {
501
797
  type ApiCredentialSort = Pick<ApiCredential, 'id' | 'mode'> & ResourceSort;
502
798
  interface ApiCredential extends Resource {
503
799
  readonly type: ApiCredentialType;
800
+ /**
801
+ * The API credential internal name..
802
+ * @example ```"My app"```
803
+ */
504
804
  name: string;
805
+ /**
806
+ * The API credential kind, can be one of: `webapp`, `sales_channel`, `integration` or the kind of app you want to fork (e.g. `orders`, `imports`, etc.)..
807
+ * @example ```"sales_channel"```
808
+ */
505
809
  kind: string;
810
+ /**
811
+ * Indicates if the API credential it's confidential..
812
+ * @example ```"true"```
813
+ */
506
814
  confidential: boolean;
815
+ /**
816
+ * The API credential redirect URI..
817
+ * @example ```"https://bluebrand.com/img/logo.svg"```
818
+ */
507
819
  redirect_uri?: Nullable<string>;
820
+ /**
821
+ * The API credential unique ID..
822
+ * @example ```"xxxx-yyyy-zzzz"```
823
+ */
508
824
  client_id: string;
825
+ /**
826
+ * The API credential unique secret..
827
+ * @example ```"xxxx-yyyy-zzzz"```
828
+ */
509
829
  client_secret: string;
830
+ /**
831
+ * The API credential scopes..
832
+ * @example ```"market:all market:9 market:122 market:6 stock_location:6 stock_location:33"```
833
+ */
510
834
  scopes: string;
835
+ /**
836
+ * The lifetime of the access token in seconds (min. `7200`, max. `31536000`. Default is `14400` for Sales channels and `7200` for other client types)..
837
+ * @example ```"7200"```
838
+ */
511
839
  expires_in?: Nullable<number>;
840
+ /**
841
+ * Indicates the environment the resource belongs to (one of `test` or `live`)..
842
+ * @example ```"test"```
843
+ */
512
844
  mode?: Nullable<string>;
845
+ /**
846
+ * Indicates if the API credential is used to create a custom app (e.g. fork a hosted app)..
847
+ */
513
848
  custom?: Nullable<boolean>;
514
849
  organization?: Nullable<Organization>;
515
850
  role?: Nullable<Role>;
516
851
  }
517
852
  interface ApiCredentialCreate extends ResourceCreate {
853
+ /**
854
+ * The API credential internal name..
855
+ * @example ```"My app"```
856
+ */
518
857
  name: string;
858
+ /**
859
+ * The API credential kind, can be one of: `webapp`, `sales_channel`, `integration` or the kind of app you want to fork (e.g. `orders`, `imports`, etc.)..
860
+ * @example ```"sales_channel"```
861
+ */
519
862
  kind: string;
863
+ /**
864
+ * The API credential redirect URI..
865
+ * @example ```"https://bluebrand.com/img/logo.svg"```
866
+ */
520
867
  redirect_uri?: Nullable<string>;
868
+ /**
869
+ * The lifetime of the access token in seconds (min. `7200`, max. `31536000`. Default is `14400` for Sales channels and `7200` for other client types)..
870
+ * @example ```"7200"```
871
+ */
521
872
  expires_in?: Nullable<number>;
873
+ /**
874
+ * Indicates the environment the resource belongs to (one of `test` or `live`)..
875
+ * @example ```"test"```
876
+ */
522
877
  mode?: Nullable<string>;
878
+ /**
879
+ * Indicates if the API credential is used to create a custom app (e.g. fork a hosted app)..
880
+ */
523
881
  custom?: Nullable<boolean>;
524
882
  organization: OrganizationRel;
525
883
  role?: Nullable<RoleRel>;
526
884
  }
527
885
  interface ApiCredentialUpdate extends ResourceUpdate {
886
+ /**
887
+ * The API credential internal name..
888
+ * @example ```"My app"```
889
+ */
528
890
  name?: Nullable<string>;
891
+ /**
892
+ * The API credential redirect URI..
893
+ * @example ```"https://bluebrand.com/img/logo.svg"```
894
+ */
529
895
  redirect_uri?: Nullable<string>;
896
+ /**
897
+ * The lifetime of the access token in seconds (min. `7200`, max. `31536000`. Default is `14400` for Sales channels and `7200` for other client types)..
898
+ * @example ```"7200"```
899
+ */
530
900
  expires_in?: Nullable<number>;
531
901
  role?: Nullable<RoleRel>;
532
902
  }
@@ -550,16 +920,51 @@ type UserRel = ResourceRel & {
550
920
  type UserSort = Pick<User, 'id'> & ResourceSort;
551
921
  interface User extends Resource {
552
922
  readonly type: UserType;
923
+ /**
924
+ * The user email..
925
+ * @example ```"user@commercelayer.io"```
926
+ */
553
927
  email: string;
928
+ /**
929
+ * The user first name..
930
+ * @example ```"John"```
931
+ */
554
932
  first_name: string;
933
+ /**
934
+ * The user last name..
935
+ * @example ```"Doe"```
936
+ */
555
937
  last_name: string;
938
+ /**
939
+ * The user preferred timezone..
940
+ * @example ```"UTC"```
941
+ */
556
942
  time_zone?: Nullable<string>;
943
+ /**
944
+ * The user 2FA setting..
945
+ */
557
946
  otp_required_for_login: boolean;
558
947
  }
559
948
  interface UserUpdate extends ResourceUpdate {
949
+ /**
950
+ * The user email..
951
+ * @example ```"user@commercelayer.io"```
952
+ */
560
953
  email?: Nullable<string>;
954
+ /**
955
+ * The user first name..
956
+ * @example ```"John"```
957
+ */
561
958
  first_name?: Nullable<string>;
959
+ /**
960
+ * The user last name..
961
+ * @example ```"Doe"```
962
+ */
562
963
  last_name?: Nullable<string>;
964
+ /**
965
+ * The user preferred timezone..
966
+ * @example ```"UTC"```
967
+ */
563
968
  time_zone?: Nullable<string>;
564
969
  }
565
970
  declare class Users extends ApiSingleton<User> {
@@ -623,11 +1028,11 @@ type ResourceSortFields = {
623
1028
  };
624
1029
 
625
1030
  declare enum ErrorType {
626
- CLIENT = "client",
627
- REQUEST = "request",
628
- RESPONSE = "response",
629
- CANCEL = "cancel",
630
- PARSE = "parse",
1031
+ CLIENT = "client",// Generic Client error
1032
+ REQUEST = "request",// Error preparing API request
1033
+ RESPONSE = "response",// Error response from API
1034
+ CANCEL = "cancel",// Forced request abort using interceptor
1035
+ PARSE = "parse",// Error parsing API resource
631
1036
  TIMEOUT = "timeout"
632
1037
  }
633
1038
  declare class SdkError extends Error {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercelayer/provisioning-sdk",
3
- "version": "2.0.0-beta.4",
3
+ "version": "2.0.0-beta.6",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "module": "lib/index.mjs",