@nextplus/js-sdk 0.0.10 → 0.0.12

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/dist/index.cjs CHANGED
@@ -32,9 +32,117 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32
32
  // src/index.ts
33
33
  var index_exports = {};
34
34
  __export(index_exports, {
35
+ AclService: () => AclService,
36
+ AddonService: () => AddonService,
37
+ AiPromptService: () => AiPromptService,
38
+ AiService: () => AiService,
39
+ ApiMethodLogService: () => ApiMethodLogService,
40
+ ApiMethodService: () => ApiMethodService,
41
+ BomService: () => BomService,
42
+ BreakService: () => BreakService,
43
+ BreakTypeService: () => BreakTypeService,
44
+ CatalogService: () => CatalogService,
45
+ CategoryService: () => CategoryService,
46
+ CertificateMappingService: () => CertificateMappingService,
47
+ CertificateService: () => CertificateService,
48
+ ChapterService: () => ChapterService,
49
+ ChatThreadService: () => ChatThreadService,
50
+ CommandPaletteHistoryService: () => CommandPaletteHistoryService,
51
+ CommentService: () => CommentService,
52
+ ConfigurationService: () => ConfigurationService,
53
+ ConnectionService: () => ConnectionService,
54
+ ConnectorFunctionService: () => ConnectorFunctionService,
55
+ ConnectorService: () => ConnectorService,
56
+ ContainerService: () => ContainerService,
57
+ ContentPackageService: () => ContentPackageService,
58
+ ContentPackageSessionService: () => ContentPackageSessionService,
59
+ ContentPackageViewService: () => ContentPackageViewService,
60
+ CustomFieldService: () => CustomFieldService,
61
+ DeviceFamilyService: () => DeviceFamilyService,
62
+ DeviceService: () => DeviceService,
63
+ DigestEmailService: () => DigestEmailService,
64
+ DocumentService: () => DocumentService,
65
+ EventService: () => EventService,
66
+ FieldService: () => FieldService,
67
+ FileParserJobService: () => FileParserJobService,
68
+ FileParserService: () => FileParserService,
69
+ FileParserStrategyJobService: () => FileParserStrategyJobService,
70
+ FolderService: () => FolderService,
71
+ FormDataCommentService: () => FormDataCommentService,
72
+ FormDataService: () => FormDataService,
73
+ FormService: () => FormService,
74
+ ForumService: () => ForumService,
75
+ GatewayService: () => GatewayService,
76
+ GroupService: () => GroupService,
77
+ IntegrationBuilderService: () => IntegrationBuilderService,
78
+ InventoryTransactionService: () => InventoryTransactionService,
79
+ LastSeenResourceService: () => LastSeenResourceService,
80
+ ListItemService: () => ListItemService,
81
+ ListService: () => ListService,
82
+ LocationService: () => LocationService,
83
+ MenusService: () => MenusService,
35
84
  NextPlusSDK: () => NextPlusSDK,
85
+ NodeService: () => NodeService,
86
+ NpsService: () => NpsService,
87
+ OpcUaServerService: () => OpcUaServerService,
88
+ OperationService: () => OperationService,
89
+ PagesService: () => PagesService,
90
+ PartAssemblyDocumentService: () => PartAssemblyDocumentService,
91
+ PartAssemblyService: () => PartAssemblyService,
92
+ PartService: () => PartService,
93
+ PostService: () => PostService,
94
+ PrintPresetService: () => PrintPresetService,
95
+ PriorityLabelService: () => PriorityLabelService,
96
+ PriorityService: () => PriorityService,
97
+ ProductionEntityEventService: () => ProductionEntityEventService,
98
+ ProductionEntityService: () => ProductionEntityService,
99
+ ProductionEntityTransactionService: () => ProductionEntityTransactionService,
100
+ ProductionEntityTypeService: () => ProductionEntityTypeService,
101
+ ProjectService: () => ProjectService,
102
+ ResourceService: () => ResourceService,
103
+ RevisionService: () => RevisionService,
104
+ RoleService: () => RoleService,
105
+ RuleService: () => RuleService,
106
+ ScromSessionService: () => ScromSessionService,
107
+ SettingService: () => SettingService,
108
+ ShiftService: () => ShiftService,
109
+ ShiftTypeService: () => ShiftTypeService,
110
+ SqlServerService: () => SqlServerService,
111
+ StationService: () => StationService,
112
+ StockService: () => StockService,
113
+ SyncClientsService: () => SyncClientsService,
114
+ SyncHistoryService: () => SyncHistoryService,
115
+ SyncService: () => SyncService,
116
+ TableService: () => TableService,
117
+ TableSetupService: () => TableSetupService,
118
+ TimeLogReportService: () => TimeLogReportService,
119
+ TimelineService: () => TimelineService,
120
+ ToolExecutionResultService: () => ToolExecutionResultService,
121
+ ToolService: () => ToolService,
122
+ TranslationService: () => TranslationService,
123
+ UnitService: () => UnitService,
124
+ UpdateInfoService: () => UpdateInfoService,
125
+ UserModelService: () => UserModelService,
126
+ VariantService: () => VariantService,
127
+ VoteMappingService: () => VoteMappingService,
128
+ WarehouseService: () => WarehouseService,
129
+ WebhookService: () => WebhookService,
130
+ WireService: () => WireService,
131
+ WiringlistService: () => WiringlistService,
132
+ WorkflowDetailsService: () => WorkflowDetailsService,
133
+ WorkflowService: () => WorkflowService,
134
+ WorkflowSessionItemRecordService: () => WorkflowSessionItemRecordService,
135
+ WorkflowSessionItemService: () => WorkflowSessionItemService,
136
+ WorkflowTypeService: () => WorkflowTypeService,
137
+ WorkorderService: () => WorkorderService,
138
+ WorkorderStatusService: () => WorkorderStatusService,
139
+ WorkorderStatusTransitionService: () => WorkorderStatusTransitionService,
140
+ WorkorderTemplateService: () => WorkorderTemplateService,
141
+ clearDefaultClient: () => clearDefaultClient,
36
142
  configure: () => configure,
37
- createSDK: () => createSDK
143
+ createSDK: () => createSDK,
144
+ getDefaultClient: () => getDefaultClient,
145
+ setDefaultClient: () => setDefaultClient
38
146
  });
39
147
  module.exports = __toCommonJS(index_exports);
40
148
  var import_debug = __toESM(require("debug"), 1);
@@ -5613,12 +5721,12 @@ var DocumentService = class {
5613
5721
  });
5614
5722
  }
5615
5723
  static deleteDocument(options) {
5616
- return (options.client ?? client).post({
5724
+ return (options?.client ?? client).post({
5617
5725
  url: "/Documents/deleteDocument",
5618
5726
  ...options,
5619
5727
  headers: {
5620
5728
  "Content-Type": "application/json",
5621
- ...options.headers
5729
+ ...options?.headers
5622
5730
  }
5623
5731
  });
5624
5732
  }
@@ -5643,12 +5751,12 @@ var DocumentService = class {
5643
5751
  });
5644
5752
  }
5645
5753
  static revertVersion(options) {
5646
- return (options.client ?? client).post({
5754
+ return (options?.client ?? client).post({
5647
5755
  url: "/Documents/revertVersion",
5648
5756
  ...options,
5649
5757
  headers: {
5650
5758
  "Content-Type": "application/json",
5651
- ...options.headers
5759
+ ...options?.headers
5652
5760
  }
5653
5761
  });
5654
5762
  }
@@ -6929,42 +7037,42 @@ var PartAssemblyService = class {
6929
7037
  });
6930
7038
  }
6931
7039
  static addPartAssembly(options) {
6932
- return (options.client ?? client).post({
7040
+ return (options?.client ?? client).post({
6933
7041
  url: "/Part-assembly/addPartAssembly",
6934
7042
  ...options,
6935
7043
  headers: {
6936
7044
  "Content-Type": "application/json",
6937
- ...options.headers
7045
+ ...options?.headers
6938
7046
  }
6939
7047
  });
6940
7048
  }
6941
7049
  static savePartAssembly(options) {
6942
- return (options.client ?? client).post({
7050
+ return (options?.client ?? client).post({
6943
7051
  url: "/Part-assembly/savePartAssembly",
6944
7052
  ...options,
6945
7053
  headers: {
6946
7054
  "Content-Type": "application/json",
6947
- ...options.headers
7055
+ ...options?.headers
6948
7056
  }
6949
7057
  });
6950
7058
  }
6951
7059
  static bulkImportParts(options) {
6952
- return (options.client ?? client).post({
7060
+ return (options?.client ?? client).post({
6953
7061
  url: "/Part-assembly/bulkImportParts",
6954
7062
  ...options,
6955
7063
  headers: {
6956
7064
  "Content-Type": "application/json",
6957
- ...options.headers
7065
+ ...options?.headers
6958
7066
  }
6959
7067
  });
6960
7068
  }
6961
7069
  static bulkChangeParts(options) {
6962
- return (options.client ?? client).post({
7070
+ return (options?.client ?? client).post({
6963
7071
  url: "/Part-assembly/bulkChangeParts",
6964
7072
  ...options,
6965
7073
  headers: {
6966
7074
  "Content-Type": "application/json",
6967
- ...options.headers
7075
+ ...options?.headers
6968
7076
  }
6969
7077
  });
6970
7078
  }
@@ -6975,22 +7083,22 @@ var PartAssemblyService = class {
6975
7083
  });
6976
7084
  }
6977
7085
  static importModels(options) {
6978
- return (options.client ?? client).post({
7086
+ return (options?.client ?? client).post({
6979
7087
  url: "/Part-assembly/importModels",
6980
7088
  ...options,
6981
7089
  headers: {
6982
7090
  "Content-Type": "application/json",
6983
- ...options.headers
7091
+ ...options?.headers
6984
7092
  }
6985
7093
  });
6986
7094
  }
6987
7095
  static findParts(options) {
6988
- return (options.client ?? client).post({
7096
+ return (options?.client ?? client).post({
6989
7097
  url: "/Part-assembly/findParts",
6990
7098
  ...options,
6991
7099
  headers: {
6992
7100
  "Content-Type": "application/json",
6993
- ...options.headers
7101
+ ...options?.headers
6994
7102
  }
6995
7103
  });
6996
7104
  }
@@ -8386,12 +8494,12 @@ var UserModelService = class {
8386
8494
  });
8387
8495
  }
8388
8496
  static createNewUser(options) {
8389
- return (options.client ?? client).post({
8497
+ return (options?.client ?? client).post({
8390
8498
  url: "/UserModels/createNewUser",
8391
8499
  ...options,
8392
8500
  headers: {
8393
8501
  "Content-Type": "application/json",
8394
- ...options.headers
8502
+ ...options?.headers
8395
8503
  }
8396
8504
  });
8397
8505
  }
@@ -10223,13 +10331,13 @@ var WorkflowService = class {
10223
10331
  * Softdelete workflow by id (recordId)
10224
10332
  */
10225
10333
  static deleteByWorkflowId(options) {
10226
- return (options.client ?? client).post({
10334
+ return (options?.client ?? client).post({
10227
10335
  responseTransformer: workflowDeleteByWorkflowIdResponseTransformer,
10228
10336
  url: "/Workflows/deleteByWorkflowId",
10229
10337
  ...options,
10230
10338
  headers: {
10231
10339
  "Content-Type": "application/json",
10232
- ...options.headers
10340
+ ...options?.headers
10233
10341
  }
10234
10342
  });
10235
10343
  }
@@ -10420,12 +10528,12 @@ var WorkflowService = class {
10420
10528
  });
10421
10529
  }
10422
10530
  static createWorkflow(options) {
10423
- return (options.client ?? client).post({
10531
+ return (options?.client ?? client).post({
10424
10532
  url: "/Workflows/createWorkflow",
10425
10533
  ...options,
10426
10534
  headers: {
10427
10535
  "Content-Type": "application/json",
10428
- ...options.headers
10536
+ ...options?.headers
10429
10537
  }
10430
10538
  });
10431
10539
  }
@@ -10521,12 +10629,12 @@ var WorkflowService = class {
10521
10629
  };
10522
10630
  var AiService = class {
10523
10631
  static completion(options) {
10524
- return (options.client ?? client).post({
10632
+ return (options?.client ?? client).post({
10525
10633
  url: "/ai/completion",
10526
10634
  ...options,
10527
10635
  headers: {
10528
10636
  "Content-Type": "application/json",
10529
- ...options.headers
10637
+ ...options?.headers
10530
10638
  }
10531
10639
  });
10532
10640
  }
@@ -11905,12 +12013,12 @@ var ToolService = class {
11905
12013
  * Import tools and serials from CSV-like data with validation
11906
12014
  */
11907
12015
  static importTools(options) {
11908
- return (options.client ?? client).post({
12016
+ return (options?.client ?? client).post({
11909
12017
  url: "/Tools/import",
11910
12018
  ...options,
11911
12019
  headers: {
11912
12020
  "Content-Type": "application/json",
11913
- ...options.headers
12021
+ ...options?.headers
11914
12022
  }
11915
12023
  });
11916
12024
  }
@@ -12171,12 +12279,12 @@ var FieldService = class {
12171
12279
  });
12172
12280
  }
12173
12281
  static getFieldsWithInnerFields(options) {
12174
- return (options.client ?? client).post({
12282
+ return (options?.client ?? client).post({
12175
12283
  url: "/Fields/getFieldsWithInnerFields",
12176
12284
  ...options,
12177
12285
  headers: {
12178
12286
  "Content-Type": "application/json",
12179
- ...options.headers
12287
+ ...options?.headers
12180
12288
  }
12181
12289
  });
12182
12290
  }
@@ -12424,12 +12532,12 @@ var WorkorderService = class {
12424
12532
  });
12425
12533
  }
12426
12534
  static createMultipleWorkordersFromTemplate(options) {
12427
- return (options.client ?? client).post({
12535
+ return (options?.client ?? client).post({
12428
12536
  url: "/Workorders/createMultipleWorkordersFromTemplate",
12429
12537
  ...options,
12430
12538
  headers: {
12431
12539
  "Content-Type": "application/json",
12432
- ...options.headers
12540
+ ...options?.headers
12433
12541
  }
12434
12542
  });
12435
12543
  }
@@ -12736,12 +12844,12 @@ var StockService = class {
12736
12844
  * Validate stock kit items
12737
12845
  */
12738
12846
  static validateLocalSerials(options) {
12739
- return (options.client ?? client).post({
12847
+ return (options?.client ?? client).post({
12740
12848
  url: "/Stocks/validateLocalSerials",
12741
12849
  ...options,
12742
12850
  headers: {
12743
12851
  "Content-Type": "application/json",
12744
- ...options.headers
12852
+ ...options?.headers
12745
12853
  }
12746
12854
  });
12747
12855
  }
@@ -12770,22 +12878,22 @@ var StockService = class {
12770
12878
  });
12771
12879
  }
12772
12880
  static createManualStock(options) {
12773
- return (options.client ?? client).post({
12881
+ return (options?.client ?? client).post({
12774
12882
  url: "/Stocks/createManualStock",
12775
12883
  ...options,
12776
12884
  headers: {
12777
12885
  "Content-Type": "application/json",
12778
- ...options.headers
12886
+ ...options?.headers
12779
12887
  }
12780
12888
  });
12781
12889
  }
12782
12890
  static createApprovedStocks(options) {
12783
- return (options.client ?? client).post({
12891
+ return (options?.client ?? client).post({
12784
12892
  url: "/Stocks/createApprovedStocks",
12785
12893
  ...options,
12786
12894
  headers: {
12787
12895
  "Content-Type": "application/json",
12788
- ...options.headers
12896
+ ...options?.headers
12789
12897
  }
12790
12898
  });
12791
12899
  }
@@ -13626,12 +13734,12 @@ var GroupService = class {
13626
13734
  });
13627
13735
  }
13628
13736
  static deleteGroup(options) {
13629
- return (options.client ?? client).post({
13737
+ return (options?.client ?? client).post({
13630
13738
  url: "/Groups/deleteGroup",
13631
13739
  ...options,
13632
13740
  headers: {
13633
13741
  "Content-Type": "application/json",
13634
- ...options.headers
13742
+ ...options?.headers
13635
13743
  }
13636
13744
  });
13637
13745
  }
@@ -13695,12 +13803,12 @@ var CategoryService = class {
13695
13803
  });
13696
13804
  }
13697
13805
  static deleteCategory(options) {
13698
- return (options.client ?? client).post({
13806
+ return (options?.client ?? client).post({
13699
13807
  url: "/Categories/deleteCategory",
13700
13808
  ...options,
13701
13809
  headers: {
13702
13810
  "Content-Type": "application/json",
13703
- ...options.headers
13811
+ ...options?.headers
13704
13812
  }
13705
13813
  });
13706
13814
  }
@@ -14858,12 +14966,12 @@ var CustomFieldService = class {
14858
14966
  });
14859
14967
  }
14860
14968
  static deleteCustomField(options) {
14861
- return (options.client ?? client).post({
14969
+ return (options?.client ?? client).post({
14862
14970
  url: "/CustomFields/deleteCustomField",
14863
14971
  ...options,
14864
14972
  headers: {
14865
14973
  "Content-Type": "application/json",
14866
- ...options.headers
14974
+ ...options?.headers
14867
14975
  }
14868
14976
  });
14869
14977
  }
@@ -14947,12 +15055,12 @@ var FormService = class {
14947
15055
  });
14948
15056
  }
14949
15057
  static performFormDataRestart(options) {
14950
- return (options.client ?? client).post({
15058
+ return (options?.client ?? client).post({
14951
15059
  url: "/Forms/performFormDataRestart",
14952
15060
  ...options,
14953
15061
  headers: {
14954
15062
  "Content-Type": "application/json",
14955
- ...options.headers
15063
+ ...options?.headers
14956
15064
  }
14957
15065
  });
14958
15066
  }
@@ -15370,12 +15478,12 @@ var FormDataService = class {
15370
15478
  });
15371
15479
  }
15372
15480
  static findInstance(options) {
15373
- return (options.client ?? client).post({
15481
+ return (options?.client ?? client).post({
15374
15482
  url: "/FormData/findInstance",
15375
15483
  ...options,
15376
15484
  headers: {
15377
15485
  "Content-Type": "application/json",
15378
- ...options.headers
15486
+ ...options?.headers
15379
15487
  }
15380
15488
  });
15381
15489
  }
@@ -15416,12 +15524,12 @@ var FormDataService = class {
15416
15524
  });
15417
15525
  }
15418
15526
  static findRelatedForms(options) {
15419
- return (options.client ?? client).post({
15527
+ return (options?.client ?? client).post({
15420
15528
  url: "/FormData/findRelatedForms",
15421
15529
  ...options,
15422
15530
  headers: {
15423
15531
  "Content-Type": "application/json",
15424
- ...options.headers
15532
+ ...options?.headers
15425
15533
  }
15426
15534
  });
15427
15535
  }
@@ -15492,12 +15600,12 @@ var FormDataService = class {
15492
15600
  });
15493
15601
  }
15494
15602
  static getFormsForSession(options) {
15495
- return (options.client ?? client).post({
15603
+ return (options?.client ?? client).post({
15496
15604
  url: "/FormData/getFormsForSession",
15497
15605
  ...options,
15498
15606
  headers: {
15499
15607
  "Content-Type": "application/json",
15500
- ...options.headers
15608
+ ...options?.headers
15501
15609
  }
15502
15610
  });
15503
15611
  }
@@ -15808,12 +15916,12 @@ var WorkflowSessionItemService = class {
15808
15916
  });
15809
15917
  }
15810
15918
  static getNptVariableValue(options) {
15811
- return (options.client ?? client).post({
15919
+ return (options?.client ?? client).post({
15812
15920
  url: "/WorkflowSessionItems/getNPTVariableValue",
15813
15921
  ...options,
15814
15922
  headers: {
15815
15923
  "Content-Type": "application/json",
15816
- ...options.headers
15924
+ ...options?.headers
15817
15925
  }
15818
15926
  });
15819
15927
  }
@@ -15821,13 +15929,13 @@ var WorkflowSessionItemService = class {
15821
15929
  * Update the time reports for a specific session
15822
15930
  */
15823
15931
  static updateTimeReports(options) {
15824
- return (options.client ?? client).post({
15932
+ return (options?.client ?? client).post({
15825
15933
  responseTransformer: workflowSessionItemUpdateTimeReportsResponseTransformer,
15826
15934
  url: "/WorkflowSessionItems/updateTimeReports",
15827
15935
  ...options,
15828
15936
  headers: {
15829
15937
  "Content-Type": "application/json",
15830
- ...options.headers
15938
+ ...options?.headers
15831
15939
  }
15832
15940
  });
15833
15941
  }
@@ -16664,12 +16772,12 @@ var SyncService = class {
16664
16772
  });
16665
16773
  }
16666
16774
  static getResourceZipByIds(options) {
16667
- return (options.client ?? client).post({
16775
+ return (options?.client ?? client).post({
16668
16776
  url: "/Sync/getResourceZipByIds",
16669
16777
  ...options,
16670
16778
  headers: {
16671
16779
  "Content-Type": "application/json",
16672
- ...options.headers
16780
+ ...options?.headers
16673
16781
  }
16674
16782
  });
16675
16783
  }
@@ -17254,12 +17362,12 @@ var FileParserService = class {
17254
17362
  });
17255
17363
  }
17256
17364
  static notify(options) {
17257
- return (options.client ?? client).post({
17365
+ return (options?.client ?? client).post({
17258
17366
  url: "/FileParsers/notify",
17259
17367
  ...options,
17260
17368
  headers: {
17261
17369
  "Content-Type": "application/json",
17262
- ...options.headers
17370
+ ...options?.headers
17263
17371
  }
17264
17372
  });
17265
17373
  }
@@ -17786,12 +17894,12 @@ var WorkflowTypeService = class {
17786
17894
  * Update the time reports for a specific session
17787
17895
  */
17788
17896
  static bulkSave(options) {
17789
- return (options.client ?? client).post({
17897
+ return (options?.client ?? client).post({
17790
17898
  url: "/WorkflowTypes/bulkSave",
17791
17899
  ...options,
17792
17900
  headers: {
17793
17901
  "Content-Type": "application/json",
17794
- ...options.headers
17902
+ ...options?.headers
17795
17903
  }
17796
17904
  });
17797
17905
  }
@@ -17844,12 +17952,12 @@ var WorkorderStatusService = class {
17844
17952
  * Bulk save of workorder statuses
17845
17953
  */
17846
17954
  static bulkSave(options) {
17847
- return (options.client ?? client).post({
17955
+ return (options?.client ?? client).post({
17848
17956
  url: "/WorkorderStatuses/bulkSave",
17849
17957
  ...options,
17850
17958
  headers: {
17851
17959
  "Content-Type": "application/json",
17852
- ...options.headers
17960
+ ...options?.headers
17853
17961
  }
17854
17962
  });
17855
17963
  }
@@ -18045,12 +18153,12 @@ var TimeLogReportService = class {
18045
18153
  * add time log
18046
18154
  */
18047
18155
  static addTimeRecord(options) {
18048
- return (options.client ?? client).post({
18156
+ return (options?.client ?? client).post({
18049
18157
  url: "/TimeLogReports/addTimeRecord",
18050
18158
  ...options,
18051
18159
  headers: {
18052
18160
  "Content-Type": "application/json",
18053
- ...options.headers
18161
+ ...options?.headers
18054
18162
  }
18055
18163
  });
18056
18164
  }
@@ -18119,12 +18227,12 @@ var PriorityService = class {
18119
18227
  });
18120
18228
  }
18121
18229
  static saveSettings(options) {
18122
- return (options.client ?? client).post({
18230
+ return (options?.client ?? client).post({
18123
18231
  url: "/Priority/saveSettings",
18124
18232
  ...options,
18125
18233
  headers: {
18126
18234
  "Content-Type": "application/json",
18127
- ...options.headers
18235
+ ...options?.headers
18128
18236
  }
18129
18237
  });
18130
18238
  }
@@ -18981,12 +19089,12 @@ var ProductionEntityService = class {
18981
19089
  * Get the related mapping of a stock
18982
19090
  */
18983
19091
  static getStockRelatedMapping(options) {
18984
- return (options.client ?? client).post({
19092
+ return (options?.client ?? client).post({
18985
19093
  url: "/ProductionEntities/getStockRelatedMapping",
18986
19094
  ...options,
18987
19095
  headers: {
18988
19096
  "Content-Type": "application/json",
18989
- ...options.headers
19097
+ ...options?.headers
18990
19098
  }
18991
19099
  });
18992
19100
  }
@@ -19717,12 +19825,12 @@ var OpcUaServerService = class {
19717
19825
  * Test connection to OPC UA server
19718
19826
  */
19719
19827
  static testConnection(options) {
19720
- return (options.client ?? client).post({
19828
+ return (options?.client ?? client).post({
19721
19829
  url: "/OpcUaServers/testConnection",
19722
19830
  ...options,
19723
19831
  headers: {
19724
19832
  "Content-Type": "application/json",
19725
- ...options.headers
19833
+ ...options?.headers
19726
19834
  }
19727
19835
  });
19728
19836
  }
@@ -20365,12 +20473,12 @@ var ShiftService = class {
20365
20473
  * Delete many shifts
20366
20474
  */
20367
20475
  static deleteMany(options) {
20368
- return (options.client ?? client).post({
20476
+ return (options?.client ?? client).post({
20369
20477
  url: "/Shifts/deleteMany",
20370
20478
  ...options,
20371
20479
  headers: {
20372
20480
  "Content-Type": "application/json",
20373
- ...options.headers
20481
+ ...options?.headers
20374
20482
  }
20375
20483
  });
20376
20484
  }
@@ -20378,12 +20486,12 @@ var ShiftService = class {
20378
20486
  * Set week as default
20379
20487
  */
20380
20488
  static setWeekAsDefault(options) {
20381
- return (options.client ?? client).post({
20489
+ return (options?.client ?? client).post({
20382
20490
  url: "/Shifts/setWeekAsDefault",
20383
20491
  ...options,
20384
20492
  headers: {
20385
20493
  "Content-Type": "application/json",
20386
- ...options.headers
20494
+ ...options?.headers
20387
20495
  }
20388
20496
  });
20389
20497
  }
@@ -21327,12 +21435,12 @@ var SqlServerService = class {
21327
21435
  * Test connection to SQL server
21328
21436
  */
21329
21437
  static testConnection(options) {
21330
- return (options.client ?? client).post({
21438
+ return (options?.client ?? client).post({
21331
21439
  url: "/SqlServers/testConnection",
21332
21440
  ...options,
21333
21441
  headers: {
21334
21442
  "Content-Type": "application/json",
21335
- ...options.headers
21443
+ ...options?.headers
21336
21444
  }
21337
21445
  });
21338
21446
  }
@@ -21581,12 +21689,12 @@ var ChatThreadService = class {
21581
21689
  });
21582
21690
  }
21583
21691
  static createThread(options) {
21584
- return (options.client ?? client).post({
21692
+ return (options?.client ?? client).post({
21585
21693
  url: "/ChatThreads/createThread",
21586
21694
  ...options,
21587
21695
  headers: {
21588
21696
  "Content-Type": "application/json",
21589
- ...options.headers
21697
+ ...options?.headers
21590
21698
  }
21591
21699
  });
21592
21700
  }
@@ -21693,30 +21801,68 @@ var isTokenValid = () => {
21693
21801
  var NextPlusSDK = class {
21694
21802
  constructor(options) {
21695
21803
  __publicField(this, "client");
21804
+ // Exposed for tree-shakeable service imports
21696
21805
  __publicField(this, "credentials");
21806
+ __publicField(this, "providedAccessToken");
21697
21807
  __publicField(this, "returnType", "data");
21698
- if (!options.email && !options.username) {
21699
- throw new Error("Either email or username must be provided");
21808
+ __publicField(this, "authMode");
21809
+ const hasToken = "accessToken" in options && options.accessToken;
21810
+ const hasPassword = "password" in options && options.password;
21811
+ if (hasToken && hasPassword) {
21812
+ throw new Error(
21813
+ "Provide either accessToken or credentials (email/username + password), not both"
21814
+ );
21700
21815
  }
21701
- if (options.email && options.username) {
21702
- throw new Error("Provide either email or username, not both");
21816
+ if (!hasToken && !hasPassword) {
21817
+ throw new Error(
21818
+ "Either accessToken or credentials (email/username + password) must be provided"
21819
+ );
21820
+ }
21821
+ if (hasToken) {
21822
+ this.authMode = "token";
21823
+ this.providedAccessToken = options.accessToken;
21824
+ setAccessToken(this.providedAccessToken, /* @__PURE__ */ new Date(), 1209600);
21825
+ } else {
21826
+ this.authMode = "credentials";
21827
+ const credConfig = options;
21828
+ if (!credConfig.email && !credConfig.username) {
21829
+ throw new Error(
21830
+ "Either email or username must be provided with password"
21831
+ );
21832
+ }
21833
+ if (credConfig.email && credConfig.username) {
21834
+ throw new Error("Provide either email or username, not both");
21835
+ }
21836
+ this.credentials = {
21837
+ email: credConfig.email,
21838
+ username: credConfig.username,
21839
+ password: credConfig.password
21840
+ };
21703
21841
  }
21704
- this.credentials = {
21705
- email: options.email,
21706
- username: options.username,
21707
- password: options.password
21708
- };
21709
21842
  this.returnType = options.returnType || "data";
21710
- if (options.baseURL.endsWith("/")) {
21711
- options.baseURL = options.baseURL.slice(0, -1);
21843
+ let baseURL = options.baseURL;
21844
+ if (!baseURL) {
21845
+ if (typeof window !== "undefined" && window.location) {
21846
+ baseURL = window.location.origin + "/api";
21847
+ } else {
21848
+ throw new Error("baseURL is required in non-browser environments");
21849
+ }
21712
21850
  }
21713
- if (!options.baseURL.endsWith("/api")) {
21714
- options.baseURL = options.baseURL + "/api";
21851
+ if (baseURL.endsWith("/")) {
21852
+ baseURL = baseURL.slice(0, -1);
21715
21853
  }
21716
- this.client = createClient({
21717
- baseUrl: options.baseURL
21718
- });
21719
- this.client.interceptors.request.use(this.authRequestInterceptor.bind(this));
21854
+ if (!baseURL.endsWith("/api")) {
21855
+ baseURL = baseURL + "/api";
21856
+ }
21857
+ this.client = createClient(
21858
+ createConfig({
21859
+ baseUrl: baseURL,
21860
+ throwOnError: options.throwOnError ?? false
21861
+ })
21862
+ );
21863
+ this.client.interceptors.request.use(
21864
+ this.authRequestInterceptor.bind(this)
21865
+ );
21720
21866
  this.createServiceProxies();
21721
21867
  }
21722
21868
  // Wrap plain developer inputs into the right container (body/query)
@@ -21726,9 +21872,21 @@ var NextPlusSDK = class {
21726
21872
  const method = methodName.toString().toLowerCase();
21727
21873
  const isFind = method.includes("find") && !method.includes("count");
21728
21874
  const isCount = method.includes("count");
21729
- const shouldUseBody = /(create|update|replace|patch|login|upsert)/i.test(methodName.toString());
21730
- const topLevelKeys = ["filter", "where", "fields", "order", "limit", "offset", "include"];
21731
- const hasTopLevelFilterBits = topLevelKeys.some((k) => Object.prototype.hasOwnProperty.call(options, k));
21875
+ const shouldUseBody = /(create|update|replace|patch|login|upsert)/i.test(
21876
+ methodName.toString()
21877
+ );
21878
+ const topLevelKeys = [
21879
+ "filter",
21880
+ "where",
21881
+ "fields",
21882
+ "order",
21883
+ "limit",
21884
+ "offset",
21885
+ "include"
21886
+ ];
21887
+ const hasTopLevelFilterBits = topLevelKeys.some(
21888
+ (k) => Object.prototype.hasOwnProperty.call(options, k)
21889
+ );
21732
21890
  if (isFind) {
21733
21891
  options.query = options.query || {};
21734
21892
  if (options.filter && typeof options.filter === "object") {
@@ -21741,7 +21899,8 @@ var NextPlusSDK = class {
21741
21899
  if (options.order !== void 0) filterObject.order = options.order;
21742
21900
  if (options.limit !== void 0) filterObject.limit = options.limit;
21743
21901
  if (options.offset !== void 0) filterObject.offset = options.offset;
21744
- if (options.include !== void 0) filterObject.include = options.include;
21902
+ if (options.include !== void 0)
21903
+ filterObject.include = options.include;
21745
21904
  if (Object.keys(filterObject).length > 0) {
21746
21905
  options.query.filter = typeof filterObject === "string" ? filterObject : JSON.stringify(filterObject);
21747
21906
  }
@@ -21763,7 +21922,8 @@ var NextPlusSDK = class {
21763
21922
  if (Object.keys(bodyCandidate).length > 0) {
21764
21923
  options.body = bodyCandidate;
21765
21924
  Object.keys(options).forEach((k) => {
21766
- if (!["body", "client", "query", "path"].includes(k)) delete options[k];
21925
+ if (!["body", "client", "query", "path"].includes(k))
21926
+ delete options[k];
21767
21927
  });
21768
21928
  }
21769
21929
  }
@@ -21782,20 +21942,29 @@ var NextPlusSDK = class {
21782
21942
  if (request.url.includes("/UserModels/login")) {
21783
21943
  return request;
21784
21944
  }
21785
- await this.ensureValidToken();
21786
- const token = getAccessToken();
21787
- if (token.token) {
21788
- request.headers.set("Authorization", token.token);
21945
+ if (this.authMode === "token") {
21946
+ if (this.providedAccessToken) {
21947
+ request.headers.set("Authorization", this.providedAccessToken);
21948
+ }
21949
+ } else {
21950
+ await this.ensureValidToken();
21951
+ const token = getAccessToken();
21952
+ if (token.token) {
21953
+ request.headers.set("Authorization", token.token);
21954
+ }
21789
21955
  }
21790
21956
  return request;
21791
21957
  }
21792
21958
  async ensureValidToken() {
21793
- if (!isTokenValid()) {
21959
+ if (this.authMode === "credentials" && !isTokenValid()) {
21794
21960
  log("Token expired or missing, refreshing...");
21795
21961
  await this.login();
21796
21962
  }
21797
21963
  }
21798
21964
  async login() {
21965
+ if (this.authMode !== "credentials" || !this.credentials) {
21966
+ throw new Error("Login is only available in credentials mode");
21967
+ }
21799
21968
  try {
21800
21969
  const loginBody = {
21801
21970
  password: this.credentials.password,
@@ -21848,7 +22017,9 @@ var NextPlusSDK = class {
21848
22017
  return result.data;
21849
22018
  }
21850
22019
  if (self.returnType === "data" && result && typeof result === "object" && "error" in result) {
21851
- const error = new Error(result.error.error.message || result.error.error.code || "Unknown error");
22020
+ const error = new Error(
22021
+ result.error.error.message || result.error.error.code || "Unknown error"
22022
+ );
21852
22023
  if (result.error.error.details) {
21853
22024
  error.details = result.error.error.details;
21854
22025
  }
@@ -21861,20 +22032,163 @@ var NextPlusSDK = class {
21861
22032
  }
21862
22033
  });
21863
22034
  }
21864
- // Manual login method (optional, for explicit control)
22035
+ // Manual login method (optional, for explicit control in credentials mode)
21865
22036
  async manualLogin() {
22037
+ if (this.authMode !== "credentials") {
22038
+ throw new Error("manualLogin is only available in credentials mode");
22039
+ }
21866
22040
  return this.login();
21867
22041
  }
22042
+ // Bind a service to this SDK's client for tree-shakeable imports
22043
+ // This eliminates the need to pass client on every call
22044
+ service(ServiceClass) {
22045
+ const client2 = this.client;
22046
+ const boundService = Object.create(ServiceClass);
22047
+ const properties = Object.getOwnPropertyNames(ServiceClass);
22048
+ properties.forEach((key) => {
22049
+ const descriptor = Object.getOwnPropertyDescriptor(ServiceClass, key);
22050
+ if (descriptor && typeof descriptor.value === "function" && key !== "constructor") {
22051
+ boundService[key] = (options = {}) => {
22052
+ return descriptor.value.call(ServiceClass, { ...options, client: client2 });
22053
+ };
22054
+ }
22055
+ });
22056
+ return boundService;
22057
+ }
21868
22058
  };
21869
22059
  var configure = (options) => {
21870
- return new NextPlusSDK(options);
22060
+ const sdk = new NextPlusSDK(options);
22061
+ setDefaultClient(sdk.client);
22062
+ Object.assign(client, sdk.client);
22063
+ return sdk;
21871
22064
  };
21872
22065
  var createSDK = (options) => {
21873
- return new NextPlusSDK(options);
21874
- };
22066
+ const sdk = new NextPlusSDK(options);
22067
+ setDefaultClient(sdk.client);
22068
+ Object.assign(client, sdk.client);
22069
+ return sdk;
22070
+ };
22071
+ var globalClient = null;
22072
+ function setDefaultClient(client2) {
22073
+ globalClient = client2;
22074
+ }
22075
+ function getDefaultClient() {
22076
+ return globalClient;
22077
+ }
22078
+ function clearDefaultClient() {
22079
+ globalClient = null;
22080
+ }
21875
22081
  // Annotate the CommonJS export names for ESM import in node:
21876
22082
  0 && (module.exports = {
22083
+ AclService,
22084
+ AddonService,
22085
+ AiPromptService,
22086
+ AiService,
22087
+ ApiMethodLogService,
22088
+ ApiMethodService,
22089
+ BomService,
22090
+ BreakService,
22091
+ BreakTypeService,
22092
+ CatalogService,
22093
+ CategoryService,
22094
+ CertificateMappingService,
22095
+ CertificateService,
22096
+ ChapterService,
22097
+ ChatThreadService,
22098
+ CommandPaletteHistoryService,
22099
+ CommentService,
22100
+ ConfigurationService,
22101
+ ConnectionService,
22102
+ ConnectorFunctionService,
22103
+ ConnectorService,
22104
+ ContainerService,
22105
+ ContentPackageService,
22106
+ ContentPackageSessionService,
22107
+ ContentPackageViewService,
22108
+ CustomFieldService,
22109
+ DeviceFamilyService,
22110
+ DeviceService,
22111
+ DigestEmailService,
22112
+ DocumentService,
22113
+ EventService,
22114
+ FieldService,
22115
+ FileParserJobService,
22116
+ FileParserService,
22117
+ FileParserStrategyJobService,
22118
+ FolderService,
22119
+ FormDataCommentService,
22120
+ FormDataService,
22121
+ FormService,
22122
+ ForumService,
22123
+ GatewayService,
22124
+ GroupService,
22125
+ IntegrationBuilderService,
22126
+ InventoryTransactionService,
22127
+ LastSeenResourceService,
22128
+ ListItemService,
22129
+ ListService,
22130
+ LocationService,
22131
+ MenusService,
21877
22132
  NextPlusSDK,
22133
+ NodeService,
22134
+ NpsService,
22135
+ OpcUaServerService,
22136
+ OperationService,
22137
+ PagesService,
22138
+ PartAssemblyDocumentService,
22139
+ PartAssemblyService,
22140
+ PartService,
22141
+ PostService,
22142
+ PrintPresetService,
22143
+ PriorityLabelService,
22144
+ PriorityService,
22145
+ ProductionEntityEventService,
22146
+ ProductionEntityService,
22147
+ ProductionEntityTransactionService,
22148
+ ProductionEntityTypeService,
22149
+ ProjectService,
22150
+ ResourceService,
22151
+ RevisionService,
22152
+ RoleService,
22153
+ RuleService,
22154
+ ScromSessionService,
22155
+ SettingService,
22156
+ ShiftService,
22157
+ ShiftTypeService,
22158
+ SqlServerService,
22159
+ StationService,
22160
+ StockService,
22161
+ SyncClientsService,
22162
+ SyncHistoryService,
22163
+ SyncService,
22164
+ TableService,
22165
+ TableSetupService,
22166
+ TimeLogReportService,
22167
+ TimelineService,
22168
+ ToolExecutionResultService,
22169
+ ToolService,
22170
+ TranslationService,
22171
+ UnitService,
22172
+ UpdateInfoService,
22173
+ UserModelService,
22174
+ VariantService,
22175
+ VoteMappingService,
22176
+ WarehouseService,
22177
+ WebhookService,
22178
+ WireService,
22179
+ WiringlistService,
22180
+ WorkflowDetailsService,
22181
+ WorkflowService,
22182
+ WorkflowSessionItemRecordService,
22183
+ WorkflowSessionItemService,
22184
+ WorkflowTypeService,
22185
+ WorkorderService,
22186
+ WorkorderStatusService,
22187
+ WorkorderStatusTransitionService,
22188
+ WorkorderTemplateService,
22189
+ clearDefaultClient,
21878
22190
  configure,
21879
- createSDK
22191
+ createSDK,
22192
+ getDefaultClient,
22193
+ setDefaultClient
21880
22194
  });