@mspcopilot/n8n-nodes-connectwise 0.2.1-beta.9 → 0.2.3

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 (56) hide show
  1. package/{dist-beta → dist-community}/credentials/ConnectWisePsaApi.credentials.js +3 -17
  2. package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/ConnectWisePsa.node.js +2 -14
  3. package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/descriptions/common.properties.js +1 -16
  4. package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/methods/fieldOptions.js +0 -1
  5. package/dist-community/nodes/ConnectWise/PSA/schema/resources/alert-consolidation.js +42 -0
  6. package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/schema/resources/custom.schema.js +1 -38
  7. package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/schema/resources/ticket.schema.js +1 -11
  8. package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/transport/cache.js +6 -84
  9. package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/transport/client.js +5 -46
  10. package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/transport/version-check.js +13 -9
  11. package/package.json +4 -6
  12. package/dist-beta/nodes/ConnectWise/PSA/ConnectWisePsaTrigger.node.js +0 -506
  13. package/dist-beta/nodes/ConnectWise/PSA/IfSchedule.node.js +0 -333
  14. package/dist-beta/nodes/ConnectWise/PSA/schema/resources/alert-consolidation.js +0 -451
  15. package/dist-beta/nodes/ConnectWise/PSA/schema/resources/diagnostics.schema.js +0 -103
  16. package/dist-beta/nodes/ConnectWise/PSA/schema/resources/reports.schema.js +0 -206
  17. /package/{dist-beta → dist-community}/LICENSE.md +0 -0
  18. /package/{dist-beta → dist-community}/credentials/connectwise-dark.svg +0 -0
  19. /package/{dist-beta → dist-community}/credentials/connectwise-light.svg +0 -0
  20. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/connectwise-dark.svg +0 -0
  21. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/connectwise-light.svg +0 -0
  22. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/descriptions/common.descriptions.js +0 -0
  23. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/descriptions/index.js +0 -0
  24. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/helpers/customFields.js +0 -0
  25. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/helpers/field-collector.js +0 -0
  26. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/helpers/field-conditions.js +0 -0
  27. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/helpers/hint-collector.js +0 -0
  28. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/helpers/index.js +0 -0
  29. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/helpers/logging.js +0 -0
  30. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/helpers/utils.js +0 -0
  31. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/methods/generated.js +0 -0
  32. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/methods/index.js +0 -0
  33. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/schema/converter/index.js +0 -0
  34. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/schema/converter/reference.generator.js +0 -0
  35. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/schema/index.js +0 -0
  36. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/schema/references.js +0 -0
  37. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/schema/reports-descriptions.js +0 -0
  38. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/schema/resources/activity.schema.js +0 -0
  39. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/schema/resources/company.schema.js +0 -0
  40. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/schema/resources/contact.schema.js +0 -0
  41. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/schema/resources/index.js +0 -0
  42. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/schema/resources/members.schema.js +0 -0
  43. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/schema/resources/ticketNote.schema.js +0 -0
  44. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/schema/resources/ticketTask.schema.js +0 -0
  45. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/schema/resources/timeEntry.schema.js +0 -0
  46. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/schema/static-fields.js +0 -0
  47. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/schema/transformer.js +0 -0
  48. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/schema/types/index.js +0 -0
  49. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/schema/types/reference.types.js +0 -0
  50. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/schema/types/resource.types.js +0 -0
  51. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/transport/access-key.js +0 -0
  52. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/transport/index.js +0 -0
  53. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/transport/operations.js +0 -0
  54. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/transport/response-transformer.js +0 -0
  55. /package/{dist-beta → dist-community}/nodes/ConnectWise/PSA/types/n8n-augmentation.d.js +0 -0
  56. /package/{dist-beta → dist-community}/nodes/ConnectWisePsa.node.json +0 -0
@@ -112,28 +112,14 @@ class ConnectWisePsaApi {
112
112
  placeholder: import_transport.DEFAULT_API_PATH,
113
113
  hint: `Leave blank to use the default API path (${import_transport.DEFAULT_API_PATH})`,
114
114
  description: "Custom API version path. Leave empty to use the default."
115
- }, ...process.env.MSPCOPILOT_BETA !== "true" ? [ {
115
+ }, {
116
116
  displayName: "Check for Updates",
117
117
  name: "checkForUpdates",
118
118
  type: "boolean",
119
119
  default: !0,
120
- hint: "Current version: 0.2.1-beta.9 (beta edition)",
120
+ hint: "Current version: 0.2.3 (community edition)",
121
121
  description: "Check for new versions of this node package and show notifications when updates are available"
122
- } ] : [], ...process.env.MSPCOPILOT_BETA === "true" ? [ {
123
- displayName: "Current version: 0.2.1-beta.9 (beta)",
124
- name: "versionInfo",
125
- type: "notice",
126
- default: ""
127
- } ] : [], ...process.env.MSPCOPILOT_BETA === "true" ? [ {
128
- displayName: "Access Key",
129
- name: "accessKey",
130
- type: "string",
131
- typeOptions: {
132
- password: !0
133
- },
134
- default: "",
135
- hint: "To enable beta or server-side features"
136
- } ] : [] ];
122
+ } ];
137
123
  async authenticate(credentials, requestOptions) {
138
124
  const serverUrl = credentials.site === "custom" ? credentials.customServer : credentials.site, base64Auth = Buffer.from(`${credentials.companyId}+${credentials.publicKey}:${credentials.privateKey}`).toString("base64");
139
125
  return requestOptions.baseURL || (requestOptions.baseURL = `https://${serverUrl}`),
@@ -46,20 +46,10 @@ const resources = {
46
46
  schema: import_contact.contactSchema,
47
47
  execute: import_contact.execute
48
48
  },
49
- ...process.env.MSPCOPILOT_BETA === "true" ? {
50
- diagnostics: {
51
- schema: require("./schema/resources/diagnostics.schema").diagnosticsSchema,
52
- execute: require("./schema/resources/diagnostics.schema").execute
53
- }
54
- } : {},
55
49
  members: {
56
50
  schema: import_members.membersSchema,
57
51
  execute: import_members.execute
58
52
  },
59
- reports: {
60
- schema: require("./schema/resources/reports.schema").reportsSchema,
61
- execute: require("./schema/resources/reports.schema").execute
62
- },
63
53
  ticket: {
64
54
  schema: import_ticket.ticketSchema,
65
55
  execute: import_ticket.execute
@@ -76,7 +66,6 @@ const resources = {
76
66
  schema: import_timeEntry.timeEntrySchema,
77
67
  execute: import_timeEntry.execute
78
68
  },
79
- ...process.env.MSPCOPILOT_BETA === "true" ? {} : {},
80
69
  custom: {
81
70
  schema: import_custom.customSchema,
82
71
  execute: import_custom.execute
@@ -85,7 +74,7 @@ const resources = {
85
74
 
86
75
  class ConnectWisePsa {
87
76
  constructor() {
88
- console.log(`🔌 ConnectWise PSA Node Loaded | 📦 v0.2.1-beta.9 | 🏗️ Build: ${"beta".toUpperCase()} (${"prod".toUpperCase()} mode)`);
77
+ console.log(`🔌 ConnectWise PSA Node Loaded | 📦 v0.2.3 | 🏗️ Build: ${"community".toUpperCase()} (${"prod".toUpperCase()} mode)`);
89
78
  }
90
79
  description={
91
80
  displayName: "ConnectWise PSA",
@@ -163,8 +152,7 @@ class ConnectWisePsa {
163
152
  ...import_methods.loadOptions,
164
153
  loadFieldsOptions: import_fieldOptions.loadFieldsOptions,
165
154
  loadOrderByFieldsOptions: import_fieldOptions.loadOrderByFieldsOptions,
166
- loadCustomFieldsOptions: import_fieldOptions.loadCustomFieldsOptions,
167
- loadReportColumns: require("./schema/resources/reports.schema").loadReportColumns
155
+ loadCustomFieldsOptions: import_fieldOptions.loadCustomFieldsOptions
168
156
  },
169
157
  listSearch: import_methods.listSearch
170
158
  };
@@ -336,22 +336,7 @@ function getCommonFields(options) {
336
336
  operation: [ "getAll", "getReport" ]
337
337
  }
338
338
  }
339
- }, ...queryOptions.cacheResponse ? [ {
340
- ...queryOptions.cacheResponse,
341
- displayOptions: {
342
- show: {
343
- operation: [ "get", "getAll", "getReport" ]
344
- }
345
- }
346
- }, {
347
- ...queryOptions.cacheDuration,
348
- displayOptions: {
349
- show: {
350
- operation: [ "get", "getAll", "getReport" ],
351
- cacheResponse: [ !0 ]
352
- }
353
- }
354
- } ] : [] ];
339
+ } ];
355
340
  return options?.only ? fields = fields.filter(f => options.only.includes(f.name)) : options?.exclude && (fields = fields.filter(f => !options.exclude.includes(f.name))),
356
341
  options?.overrides && (fields = fields.map(field => options.overrides[field.name] ? {
357
342
  ...field,
@@ -44,7 +44,6 @@ const resourceSchemas = {
44
44
  ticketNote: import_ticketNote.ticketNoteSchema,
45
45
  ticketTask: import_ticketTask.ticketTaskSchema,
46
46
  timeEntry: import_timeEntry.timeEntrySchema,
47
- reports: require("../schema/resources/reports.schema").reportsSchema,
48
47
  custom: import_custom.customSchema
49
48
  };
50
49
 
@@ -0,0 +1,42 @@
1
+ var __defProp = Object.defineProperty;
2
+
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+
9
+ var __export = (target, all) => {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: !0
13
+ });
14
+ }, __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ return to;
20
+ };
21
+
22
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
+ value: !0
24
+ }), mod);
25
+
26
+ var alert_consolidation_exports = {};
27
+
28
+ __export(alert_consolidation_exports, {
29
+ executeSmartConsolidation: () => executeSmartConsolidation
30
+ });
31
+
32
+ module.exports = __toCommonJS(alert_consolidation_exports);
33
+
34
+ var import_n8n_workflow = require("n8n-workflow"), import_luxon = require("luxon"), import_crypto = require("crypto"), import_client = require("../../transport/client"), import_utils = require("../../helpers/utils");
35
+
36
+ const executeSmartConsolidationStub = async function(itemIndex) {
37
+ return (0, import_utils.returnProOnlyMessage)(this, itemIndex);
38
+ }, executeSmartConsolidation = executeSmartConsolidationStub;
39
+
40
+ 0 && (module.exports = {
41
+ executeSmartConsolidation: executeSmartConsolidation
42
+ });
@@ -85,44 +85,7 @@ const customFields = [ {
85
85
  hint: `View list of endpoints in the <a href="https://${import_common2.DOCURL_PREFIX}/connectwise-api" target="_blank">documentation</a>`,
86
86
  placeholder: "e.g., /company/companies/:id or https://api.connectwise.com/...",
87
87
  description: "The API endpoint. Can be a full URL or a partial path. Include any parameters like the ID directly in the URL."
88
- }, ...process.env.MSPCOPILOT_BETA === "true" ? [ {
89
- displayName: "Custom Fields",
90
- name: "customFields",
91
- type: "fixedCollection",
92
- placeholder: "Add Custom Field",
93
- default: {},
94
- displayOptions: {
95
- show: {
96
- resource: [ "custom" ],
97
- operation: [ "create", "update" ]
98
- }
99
- },
100
- typeOptions: {
101
- multipleValues: !0
102
- },
103
- options: [ {
104
- name: "field",
105
- displayName: "Custom Field",
106
- values: [ {
107
- displayName: "Field",
108
- name: "id",
109
- type: "options",
110
- required: !0,
111
- typeOptions: {
112
- loadOptionsMethod: "loadCustomFieldsOptions",
113
- loadOptionsDependsOn: [ "endpoint" ]
114
- },
115
- default: "",
116
- description: "Choose from available custom fields for this endpoint"
117
- }, {
118
- displayName: "Value",
119
- name: "value",
120
- type: "string",
121
- default: "",
122
- description: "Value for the custom field. Leave empty to nullify. Ensure you pass a value compatible with the field type. Checkbox can be true/false/1/0/on/off."
123
- } ]
124
- } ]
125
- } ] : [], ...(0, import_common.getCommonFields)({
88
+ }, ...(0, import_common.getCommonFields)({
126
89
  overrides: {
127
90
  fields: {
128
91
  type: "string",
@@ -75,11 +75,6 @@ const ticketFields = [ {
75
75
  value: "update",
76
76
  description: "Update a ticket",
77
77
  action: "Update a ticket"
78
- }, {
79
- name: "Smart Alert Consolidation ✨",
80
- value: "smartAlertConsolidation",
81
- description: "Create, update or close tickets with smart alert consolidation",
82
- action: "Smart alert consolidation ✨"
83
78
  } ],
84
79
  default: "create"
85
80
  }, {
@@ -95,10 +90,6 @@ const ticketFields = [ {
95
90
  }, {
96
91
  name: "Project Ticket",
97
92
  value: "project"
98
- }, {
99
- name: "Auto ✨",
100
- value: "auto",
101
- description: "Automatically detect ticket type"
102
93
  } ],
103
94
  displayOptions: {
104
95
  show: {
@@ -511,8 +502,7 @@ const ticketFields = [ {
511
502
  ticketType: [ "project" ]
512
503
  }
513
504
  }
514
- }, ...process.env.MSPCOPILOT_BETA === "true" ? [ (0, import_common.getCustomFieldsProperty)("service_tickets") ] : [], ...(0,
515
- import_common.getCommonFields)(), {
505
+ }, ...(0, import_common.getCommonFields)(), {
516
506
  displayName: `New to Smart Alert Consolidation? Start with the <a href="https://${import_common2.DOCURL_PREFIX}/smart-alert-consolidation${import_common2.DOCURL_SUFFIX}" target="_blank">setup guide</a> for a walkthrough of all options.`,
517
507
  name: "smartAlertConsolidationNotice",
518
508
  type: "notice",
@@ -1,12 +1,10 @@
1
- var __create = Object.create;
2
-
3
1
  var __defProp = Object.defineProperty;
4
2
 
5
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
4
 
7
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
6
 
9
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
8
 
11
9
  var __export = (target, all) => {
12
10
  for (var name in all) __defProp(target, name, {
@@ -21,11 +19,7 @@ var __export = (target, all) => {
21
19
  return to;
22
20
  };
23
21
 
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {},
25
- __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)), __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
22
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
29
23
  value: !0
30
24
  }), mod);
31
25
 
@@ -50,95 +44,23 @@ function getBestErrorMessage(operationError) {
50
44
  }
51
45
 
52
46
  async function getCacheClient() {
53
- if (process.env.MSPCOPILOT_BETA !== "true") return null;
54
- if (!Redis && process.env.MSPCOPILOT_BETA === "true") try {
55
- Redis = (await import("ioredis")).default;
56
- } catch (error) {
57
- return console.error("Failed to load cache module:", error), null;
58
- }
59
- if (cacheClient && cacheClient.status === "ready") return cacheClient;
60
- if (cacheClient && [ "end", "close" ].includes(cacheClient.status)) {
61
- try {
62
- cacheClient.disconnect(!1);
63
- } catch {}
64
- cacheClient = null;
65
- }
66
- if (!cacheClient && Redis) try {
67
- cacheClient = new Redis({
68
- host: process.env.QUEUE_BULL_REDIS_HOST || "localhost",
69
- port: parseInt(process.env.QUEUE_BULL_REDIS_PORT || "6379"),
70
- password: process.env.QUEUE_BULL_REDIS_PASSWORD || "",
71
- db: 1,
72
- retryStrategy: () => null,
73
- lazyConnect: !0,
74
- enableOfflineQueue: !1,
75
- connectTimeout: 1e3
76
- }), cacheClient.on("error", err => {
77
- console.error("Cache connection error:", err.message), lastConnectionError = err.message;
78
- });
79
- } catch (error) {
80
- console.error("Failed to create cache client:", error), cacheClient = null;
81
- }
82
- return cacheClient;
47
+ return null;
83
48
  }
84
49
 
85
50
  async function getCached(key) {
86
- if (process.env.MSPCOPILOT_BETA !== "true") return {
51
+ return {
87
52
  data: null
88
53
  };
89
- const redis = await getCacheClient();
90
- if (!redis) return {
91
- data: null,
92
- error: "Redis not available"
93
- };
94
- try {
95
- const cached = await redis.get(key);
96
- return cached !== null ? {
97
- data: JSON.parse(cached)
98
- } : {
99
- data: null
100
- };
101
- } catch (error) {
102
- return console.error("Cache get error:", error.message), {
103
- data: null,
104
- error: getBestErrorMessage(error.message)
105
- };
106
- }
107
54
  }
108
55
 
109
56
  async function setCached(key, data, ttl) {
110
- if (process.env.MSPCOPILOT_BETA !== "true") return {
111
- success: !1
112
- };
113
- const redis = await getCacheClient();
114
- if (!redis) return {
115
- success: !1,
116
- error: "Redis not available"
117
- };
118
- if (ttl <= 0) return {
57
+ return {
119
58
  success: !1
120
59
  };
121
- try {
122
- return await redis.setex(key, ttl, JSON.stringify(data)), {
123
- success: !0
124
- };
125
- } catch (error) {
126
- return console.error("Cache set error:", error.message), {
127
- success: !1,
128
- error: getBestErrorMessage(error.message)
129
- };
130
- }
131
60
  }
132
61
 
133
62
  async function deleteCached(key) {
134
- if (process.env.MSPCOPILOT_BETA !== "true") return !1;
135
- const redis = await getCacheClient();
136
- if (!redis) return !1;
137
- try {
138
- return await redis.del(key) > 0;
139
- } catch (error) {
140
- return console.error("Cache del error:", error.message), !1;
141
- }
63
+ return !1;
142
64
  }
143
65
 
144
66
  async function clearAllCached() {
@@ -43,7 +43,7 @@ module.exports = __toCommonJS(client_exports);
43
43
 
44
44
  var import_n8n_workflow = require("n8n-workflow"), import_logging = require("../helpers/logging"), import_hint_collector = require("../helpers/hint-collector");
45
45
 
46
- const OPTIONS_CACHE_TTL = 120, DEFAULT_API_PATH = "v4_6_release/apis/3.0";
46
+ const DEFAULT_API_PATH = "v4_6_release/apis/3.0";
47
47
 
48
48
  function extractApiError(error) {
49
49
  let errorMessage = "Request failed";
@@ -91,51 +91,10 @@ async function connectWiseApiRequest(method, endpoint, body = {}, qs = {}, optio
91
91
  } catch (error) {
92
92
  console.warn("Version check module load failed:", error);
93
93
  }
94
- if (process.env.MSPCOPILOT_BETA === "true") {
95
- const {createHash: createHash} = await import("crypto"), {getCached: getCached, setCached: setCached, deleteCached: deleteCached, getCacheConfig: getCacheConfig} = await import("./cache.js");
96
- let cacheConfig = {
97
- enabled: !1,
98
- ttl: 0
99
- };
100
- if ("getNodeParameter" in this && method === "GET") try {
101
- cacheConfig = getCacheConfig(this, 0);
102
- } catch {}
103
- process.env.MSPCOPILOT_BETA === "true" && options.optionsCache === !0 && method === "GET" && (cacheConfig = {
104
- enabled: !0,
105
- ttl: OPTIONS_CACHE_TTL
106
- });
107
- let cacheKey;
108
- if (cacheConfig.enabled) {
109
- const credentials = await this.getCredentials("connectWisePsaApi"), cacheKeyData = {
110
- endpoint: endpoint,
111
- qs: qs,
112
- options: options
113
- }, hash = createHash("sha256").update(JSON.stringify(cacheKeyData)).digest("hex").substring(0, 16);
114
- if (cacheKey = `cw:psa:${credentials.companyId}:${hash}`, cacheConfig.ttl === 0) await deleteCached(cacheKey),
115
- console.log("🗑️ Cache invalidated for", endpoint), options.optionsCache || (0,
116
- import_hint_collector.hint)(this, "cache_invalidated"); else {
117
- const cacheResult = await getCached(cacheKey);
118
- if (console.log(`💾 Cache lookup for ${endpoint}: ${cacheResult.data ? "✅ HIT" : "❌ MISS"}`, {
119
- qs: qs,
120
- options: options
121
- }), cacheResult.error && !options.optionsCache && (0, import_hint_collector.hint)(this, "cache_error", cacheResult.error),
122
- cacheResult.data) return options.optionsCache || (0, import_hint_collector.hint)(this, "cache_hit"),
123
- cacheResult.data;
124
- }
125
- }
126
- const response = await connectWiseHttpRequest.call(this, method, endpoint, body, qs, options);
127
- if (cacheKey && cacheConfig.ttl > 0) {
128
- const setResult = await setCached(cacheKey, response, cacheConfig.ttl);
129
- if (console.log(`💾 Storing response in cache for ${endpoint} - TTL=${cacheConfig.ttl}s, Data=${Array.isArray(response) ? `${response.length} items` : "single item"}, Key=${cacheKey}`),
130
- !options.optionsCache) {
131
- if (setResult.error) (0, import_hint_collector.hint)(this, "cache_error", setResult.error); else if (setResult.success) {
132
- const minutes = Math.floor(cacheConfig.ttl / 60), ttlMessage = minutes > 0 ? `${minutes} minutes` : `${cacheConfig.ttl} seconds`;
133
- (0, import_hint_collector.hint)(this, "cache_stored", ttlMessage);
134
- }
135
- }
136
- }
137
- return response;
138
- } else return await connectWiseHttpRequest.call(this, method, endpoint, body, qs, options);
94
+ if ("getNodeParameter" in this && method === "GET") try {
95
+ const cacheResponse = this.getNodeParameter("cacheResponse", 0, !1);
96
+ } catch {}
97
+ return await connectWiseHttpRequest.call(this, method, endpoint, body, qs, options);
139
98
  }
140
99
 
141
100
  async function connectWiseHttpRequest(method, endpoint, body = {}, qs = {}, options = {}) {
@@ -39,7 +39,7 @@ module.exports = __toCommonJS(version_check_exports);
39
39
 
40
40
  var fs = __toESM(require("fs/promises")), path = __toESM(require("path")), os = __toESM(require("os")), import_common = require("../descriptions/common.descriptions"), import_hint_collector = require("../helpers/hint-collector");
41
41
 
42
- const CACHE_FILE_PATH = path.join(os.tmpdir(), "connectwise-n8n-version-cache.json"), CURRENT_VERSION = "0.2.1-beta.9";
42
+ const CACHE_FILE_PATH = path.join(os.tmpdir(), "connectwise-n8n-version-cache.json"), CURRENT_VERSION = "0.2.3";
43
43
 
44
44
  let inMemoryCache = null, cacheLoadPromise = null, fetchInProgress = !1;
45
45
 
@@ -48,7 +48,7 @@ async function initializeCache() {
48
48
  const fileContent = await fs.readFile(CACHE_FILE_PATH, "utf-8"), cacheEntry = JSON.parse(fileContent);
49
49
  if (Date.now() < cacheEntry.expires ? (cacheEntry.data.updateAvailable && cacheEntry.data.latest === CURRENT_VERSION && (cacheEntry.data.updateAvailable = !1),
50
50
  inMemoryCache = cacheEntry.data, inMemoryCache.updateAvailable && (console.log(`🎉 ConnectWise PSA Node v${inMemoryCache.latest} is available! (current: v${CURRENT_VERSION})`),
51
- console.log(` Beta upgrade guide: https://${import_common.DOCURL_PREFIX}/beta-upgrade${import_common.DOCURL_SUFFIX}`))) : cacheEntry.data?.accessKeyInfo && (inMemoryCache = cacheEntry.data),
51
+ process.env.MSPCOPILOT_BETA === "true" ? console.log(` Beta upgrade guide: https://${import_common.DOCURL_PREFIX}/beta-upgrade${import_common.DOCURL_SUFFIX}`) : console.log(` View changelog: https://${import_common.CHANGELOG_URL}`))) : cacheEntry.data?.accessKeyInfo && (inMemoryCache = cacheEntry.data),
52
52
  inMemoryCache?.accessKeyInfo) try {
53
53
  const {updateAccessKeyFromServer: updateAccessKeyFromServer} = await import("./access-key.js");
54
54
  updateAccessKeyFromServer(inMemoryCache.accessKeyInfo);
@@ -64,7 +64,7 @@ async function saveCache(versionInfo) {
64
64
  };
65
65
  try {
66
66
  await fs.writeFile(CACHE_FILE_PATH, JSON.stringify(cacheEntry, null, 2), "utf-8"),
67
- console.log("📦 Version check cache saved to disk (beta build)");
67
+ console.log("📦 Version check cache saved to disk (community build)");
68
68
  } catch (error) {
69
69
  console.warn("⚠️ Failed to save version check cache to disk:", error);
70
70
  }
@@ -77,7 +77,7 @@ async function fetchLatestVersion(accessKey) {
77
77
  lastChecked: Date.now()
78
78
  };
79
79
  try {
80
- const effectiveBuild = (process.env.MSPCOPILOT_BETA === "true", "beta");
80
+ const effectiveBuild = process.env.MSPCOPILOT_BETA === "true" ? "beta" : "community";
81
81
  console.log(`🔍 Checking for updates (${effectiveBuild} v${CURRENT_VERSION})...`);
82
82
  const controller = new AbortController, timeoutId = setTimeout(() => controller.abort(), 5e3), url = `${import_common.VERSION_CHECK_URL}?version=${CURRENT_VERSION}&build=${effectiveBuild}`, headers = {
83
83
  Accept: "application/json"
@@ -124,13 +124,17 @@ function checkForUpdatesAsync(accessKey) {
124
124
 
125
125
  async function checkAndNotifyUpdate(context) {
126
126
  try {
127
- process.env.MSPCOPILOT_BETA;
128
- const accessKey = (await context.getCredentials("connectWisePsaApi")).accessKey;
129
- if (!!0) return;
130
- checkForUpdatesAsync(accessKey), inMemoryCache?.updateAvailable && (0, import_hint_collector.hint)(context, "beta_update", {
127
+ process.env.MSPCOPILOT_BETA === "true" && (0, import_hint_collector.hint)(context, "beta_downgrade");
128
+ const credentials = await context.getCredentials("connectWisePsaApi"), accessKey = credentials.accessKey;
129
+ if (!(process.env.MSPCOPILOT_BETA === "true" ? !0 : credentials.checkForUpdates)) return;
130
+ checkForUpdatesAsync(accessKey), inMemoryCache?.updateAvailable && (process.env.MSPCOPILOT_BETA === "true" ? (0,
131
+ import_hint_collector.hint)(context, "beta_update", {
131
132
  version: inMemoryCache.latest,
132
133
  message: inMemoryCache.message
133
- });
134
+ }) : (0, import_hint_collector.hint)(context, "version_update", {
135
+ version: inMemoryCache.latest,
136
+ message: inMemoryCache.message
137
+ }));
134
138
  } catch (error) {
135
139
  console.warn("⚠️ Version check failed:", error);
136
140
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mspcopilot/n8n-nodes-connectwise",
3
- "version": "0.2.1-beta.9",
3
+ "version": "0.2.3",
4
4
  "description": "n8n node to integrate with ConnectWise PSA",
5
5
  "keywords": [
6
6
  "n8n-community-node-package"
@@ -24,17 +24,15 @@
24
24
  "postinstall": "echo 'ConnectWise PSA node installed successfully'"
25
25
  },
26
26
  "files": [
27
- "dist-beta"
27
+ "dist-community"
28
28
  ],
29
29
  "n8n": {
30
30
  "n8nNodesApiVersion": 1,
31
31
  "credentials": [
32
- "dist-beta/credentials/ConnectWisePsaApi.credentials.js"
32
+ "dist-community/credentials/ConnectWisePsaApi.credentials.js"
33
33
  ],
34
34
  "nodes": [
35
- "dist-beta/nodes/ConnectWise/PSA/ConnectWisePsa.node.js",
36
- "dist-beta/nodes/ConnectWise/PSA/ConnectWisePsaTrigger.node.js",
37
- "dist-beta/nodes/ConnectWise/PSA/IfSchedule.node.js"
35
+ "dist-community/nodes/ConnectWise/PSA/ConnectWisePsa.node.js"
38
36
  ]
39
37
  },
40
38
  "dependencies": {