@worknice/js-sdk 0.0.1 → 0.0.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 (117) hide show
  1. package/dist/_types-BXw9D0Qi.d.ts +642 -0
  2. package/dist/api/WorkniceIntegrationLogger.d.ts +99 -0
  3. package/dist/api/WorkniceIntegrationLogger.js +173 -0
  4. package/dist/api/WorkniceIntegrationLogger.js.map +1 -0
  5. package/dist/api/_generated.d.ts +357 -22
  6. package/dist/api/_generated.js.map +1 -1
  7. package/dist/api/_types.d.ts +2 -2
  8. package/dist/api/_types.js +1 -0
  9. package/dist/api/_types.js.map +1 -1
  10. package/dist/api/createApiOperation.d.ts +1 -1
  11. package/dist/api/createWorkniceClient.d.ts +1 -1
  12. package/dist/api/createWorkniceClient.js +22 -2
  13. package/dist/api/createWorkniceClient.js.map +1 -1
  14. package/dist/api/operations/activateIntegration.d.ts +1 -1
  15. package/dist/api/operations/authorizeIntegration.d.ts +20 -0
  16. package/dist/api/operations/authorizeIntegration.js +23 -0
  17. package/dist/api/operations/authorizeIntegration.js.map +1 -0
  18. package/dist/api/operations/completeSync.d.ts +20 -0
  19. package/dist/api/operations/completeSync.js +23 -0
  20. package/dist/api/operations/completeSync.js.map +1 -0
  21. package/dist/api/operations/createApiToken.d.ts +1 -1
  22. package/dist/api/operations/createDataImport.d.ts +12 -0
  23. package/dist/api/operations/createDataImport.js +25 -0
  24. package/dist/api/operations/createDataImport.js.map +1 -0
  25. package/dist/api/operations/createPersonConnection.d.ts +132 -0
  26. package/dist/api/operations/createPersonConnection.js +65 -0
  27. package/dist/api/operations/createPersonConnection.js.map +1 -0
  28. package/dist/api/operations/createPersonDataImportLine.d.ts +22 -0
  29. package/dist/api/operations/createPersonDataImportLine.js +49 -0
  30. package/dist/api/operations/createPersonDataImportLine.js.map +1 -0
  31. package/dist/api/operations/deleteApiToken.d.ts +1 -1
  32. package/dist/api/operations/deletePersonConnection.d.ts +10 -0
  33. package/dist/api/operations/deletePersonConnection.js +21 -0
  34. package/dist/api/operations/deletePersonConnection.js.map +1 -0
  35. package/dist/api/operations/getApiTokens.d.ts +1 -1
  36. package/dist/api/operations/getIntegration.d.ts +65 -0
  37. package/dist/api/operations/getIntegration.js +32 -0
  38. package/dist/api/operations/getIntegration.js.map +1 -0
  39. package/dist/api/operations/getPeople.d.ts +65 -0
  40. package/dist/api/operations/getPeople.js +79 -0
  41. package/dist/api/operations/getPeople.js.map +1 -0
  42. package/dist/api/operations/getPersonConnections.d.ts +107 -0
  43. package/dist/api/operations/getPersonConnections.js +43 -0
  44. package/dist/api/operations/getPersonConnections.js.map +1 -0
  45. package/dist/api/operations/initializeIntegration.d.ts +1 -1
  46. package/dist/api/operations/updatePersonConnection.d.ts +132 -0
  47. package/dist/api/operations/updatePersonConnection.js +65 -0
  48. package/dist/api/operations/updatePersonConnection.js.map +1 -0
  49. package/dist/employee-records/EQUALITY_CHECKS.d.ts +1 -0
  50. package/dist/employee-records/EQUALITY_CHECKS.js +1 -2
  51. package/dist/employee-records/EQUALITY_CHECKS.js.map +1 -1
  52. package/dist/employee-records/_types.d.ts +13 -12
  53. package/dist/employee-records/comparePersonDataTransferLines.d.ts +1 -0
  54. package/dist/employee-records/comparePersonDataTransferLines.js +0 -3
  55. package/dist/employee-records/comparePersonDataTransferLines.js.map +1 -1
  56. package/dist/employee-records/index.d.ts +5 -4
  57. package/dist/employee-records/mergePersonDataTransferLines.d.ts +1 -0
  58. package/dist/employee-records/mergePersonDataTransferLines.js +0 -1
  59. package/dist/employee-records/mergePersonDataTransferLines.js.map +1 -1
  60. package/dist/employee-records/validatePersonDataTransferLine.d.ts +1 -0
  61. package/dist/employee-records/validatePersonDataTransferLineBankAccounts.d.ts +1 -0
  62. package/dist/employee-records/validatePersonDataTransferLineBankAccounts.js +10 -9
  63. package/dist/employee-records/validatePersonDataTransferLineBankAccounts.js.map +1 -1
  64. package/dist/employee-records/validatePersonDataTransferLineEmergencyContacts.d.ts +1 -0
  65. package/dist/employee-records/validatePersonDataTransferLinePersonalDetails.d.ts +1 -0
  66. package/dist/employee-records/validatePersonDataTransferLinePersonalDetails.js +1 -3
  67. package/dist/employee-records/validatePersonDataTransferLinePersonalDetails.js.map +1 -1
  68. package/dist/employee-records/validatePersonDataTransferLinePostalAddress.d.ts +1 -0
  69. package/dist/employee-records/validatePersonDataTransferLineResidentialAddress.d.ts +1 -0
  70. package/dist/employee-records/validatePersonDataTransferLineSuperFunds.d.ts +1 -0
  71. package/dist/employee-records/validatePersonDataTransferLineTaxDetails.d.ts +1 -0
  72. package/dist/employee-records/validatePersonDataTransferLineTenure.d.ts +1 -0
  73. package/dist/employee-records/validatePersonDataTransferLineTenure.js +1 -1
  74. package/dist/employee-records/validatePersonDataTransferLineTenure.js.map +1 -1
  75. package/dist/helpers/_types.d.ts +7 -6
  76. package/dist/helpers/handleCreateIntegrationWebhook.d.ts +3 -2
  77. package/dist/helpers/handleCreateIntegrationWebhook.js +6 -4
  78. package/dist/helpers/handleCreateIntegrationWebhook.js.map +1 -1
  79. package/dist/helpers/handleGetAuthorizationUrlWebhook.d.ts +3 -2
  80. package/dist/helpers/handleGetAuthorizationUrlWebhook.js +4 -1
  81. package/dist/helpers/handleGetAuthorizationUrlWebhook.js.map +1 -1
  82. package/dist/helpers/handleGetLeaveBalancesWebhook.d.ts +14 -0
  83. package/dist/helpers/handleGetLeaveBalancesWebhook.js +22 -0
  84. package/dist/helpers/handleGetLeaveBalancesWebhook.js.map +1 -0
  85. package/dist/helpers/handleRequestWithWorknice.d.ts +9 -14
  86. package/dist/helpers/handleRequestWithWorknice.js +40 -19
  87. package/dist/helpers/handleRequestWithWorknice.js.map +1 -1
  88. package/dist/helpers/handleTriggerIntegrationSyncWebhook.d.ts +72 -0
  89. package/dist/helpers/handleTriggerIntegrationSyncWebhook.js +600 -0
  90. package/dist/helpers/handleTriggerIntegrationSyncWebhook.js.map +1 -0
  91. package/dist/helpers/index.d.ts +8 -2
  92. package/dist/helpers/index.js +9 -1
  93. package/dist/helpers/index.js.map +1 -1
  94. package/dist/index.d.ts +5 -4
  95. package/dist/utils/disambiguatePersonConnections.d.ts +25 -0
  96. package/dist/utils/disambiguatePersonConnections.js +18 -0
  97. package/dist/utils/disambiguatePersonConnections.js.map +1 -0
  98. package/dist/utils/isAfter.d.ts +4 -4
  99. package/dist/utils/isAfter.js +1 -1
  100. package/dist/utils/isAfter.js.map +1 -1
  101. package/dist/utils/isNotNullable.d.ts +10 -0
  102. package/dist/utils/isNotNullable.js +6 -0
  103. package/dist/utils/isNotNullable.js.map +1 -0
  104. package/dist/utils/isSamePlainDate.d.ts +1 -1
  105. package/dist/utils/isSamePlainDate.js +1 -1
  106. package/dist/utils/isSamePlainDate.js.map +1 -1
  107. package/dist/utils/isValidPlainDate.d.ts +1 -1
  108. package/dist/utils/isValidPlainDate.js +1 -1
  109. package/dist/utils/isValidPlainDate.js.map +1 -1
  110. package/dist/utils/parsePlainDate.d.ts +1 -1
  111. package/dist/utils/parsePlainDate.js +1 -1
  112. package/dist/utils/parsePlainDate.js.map +1 -1
  113. package/dist/webhooks.d.ts +42 -0
  114. package/dist/webhooks.js +1 -0
  115. package/dist/webhooks.js.map +1 -0
  116. package/package.json +11 -7
  117. package/dist/_types-DsB4q143.d.ts +0 -127
@@ -0,0 +1,99 @@
1
+ import { W as WorkniceClient } from '../_types-BXw9D0Qi.js';
2
+ import './_generated.js';
3
+
4
+ type Logger = Pick<Console, "debug" | "error" | "info" | "warn"> & Partial<Pick<Console, "group" | "groupEnd">>;
5
+ declare class WorkniceIntegrationLogger {
6
+ /**
7
+ * The Worknice client used to send the logs to the server. If null, the logs
8
+ * will be buffered until the logger is initialized.
9
+ */
10
+ private client;
11
+ /**
12
+ * A promise used to ensure that only one request is in progress at a time. If
13
+ * a flush is called while a request is in progress, the flush will wait for
14
+ * the request to finish before starting a new one.
15
+ */
16
+ private currentRequest;
17
+ /**
18
+ * The integration ID the logs will be associated with. If undefined, the
19
+ * logs will be buffered until the logger has been initialized.
20
+ */
21
+ private integrationId;
22
+ /**
23
+ * The random ID for the integration log to which the logs will be appended.
24
+ */
25
+ private integrationLogId;
26
+ /**
27
+ * Determines when the logger should flush the logs. Calling info(), error(),
28
+ * warn(), indent() or dedent() will automatically flush the logs if the last
29
+ * flush was more than 1 second ago.
30
+ */
31
+ private lastFlush;
32
+ /**
33
+ * A flag is used to determine whether a new log should be created when the
34
+ * logger is flushed. The first time the logger is flushed, a new log will be
35
+ * created. Subsequent flushes will append to the existing log.
36
+ */
37
+ private logCreated;
38
+ /**
39
+ * A Console-like object with which messages will be logger.
40
+ */
41
+ private logger;
42
+ /**
43
+ * Backlog of log messages that have not yet been sent to Worknice. The logs
44
+ * will be sent to the server when the logger is flushed and the backlog will
45
+ * be cleared.
46
+ */
47
+ private logs;
48
+ /**
49
+ * Determines the current indentation level of the log messages. The indent()
50
+ * and dedent() functions can be used to increase or decrease the indentation
51
+ * level.
52
+ */
53
+ private messageIndent;
54
+ /**
55
+ * A logger can log messages to both a Console-like object and to a Worknice
56
+ * integration's logs which can be view by a Worknice user. By default,
57
+ * messages are only logged to the console, but when a Worknice integration is
58
+ * connected using the connect() method, the messages will also be logged to
59
+ * Worknice.
60
+ * @param logger A Console-like object with which messages can be logged.
61
+ * @example
62
+ * ```js
63
+ * const logger = new WorkniceIntegrationLogger(console);
64
+ * ```
65
+ */
66
+ constructor(logger?: Logger);
67
+ /**
68
+ * Connects the logger to a Worknice integration. If there are previously
69
+ * logged messages that need to be flushed, a new integration log will be
70
+ * instantly created and the messages flushed to it. Otherwise, an integration
71
+ * log will be created if/when the first message is logged.
72
+ */
73
+ connect(client: WorkniceClient, integrationId: string): void;
74
+ /**
75
+ * Logs a debug message. Debug messages are only logged to the console and are
76
+ * never append to the Worknice integration logs.
77
+ */
78
+ debug(message: string): void;
79
+ dedent(message?: string): void;
80
+ private enqueue;
81
+ error(message: string): void;
82
+ /**
83
+ * Flushes the log buffer to the server. The info() function will
84
+ * automatically flush the logs if the last flush was more than 1 second
85
+ * ago, but the flush() function should be called manually at the end of the
86
+ * script to ensure that all logs are sent to the server.
87
+ */
88
+ flush(): Promise<void>;
89
+ indent(message?: string): void;
90
+ /**
91
+ * Logs an informational message. The message will be appended to the log
92
+ * buffer and flushed to the server if the last flush was more than 1 second
93
+ * ago.
94
+ */
95
+ info(message: string): void;
96
+ warn(message: string): void;
97
+ }
98
+
99
+ export { type Logger, WorkniceIntegrationLogger as default };
@@ -0,0 +1,173 @@
1
+ import gql from "dedent";
2
+ import { Temporal } from "temporal-polyfill";
3
+ import { v4 as uuid } from "uuid";
4
+ class WorkniceIntegrationLogger {
5
+ /**
6
+ * The Worknice client used to send the logs to the server. If null, the logs
7
+ * will be buffered until the logger is initialized.
8
+ */
9
+ client = null;
10
+ /**
11
+ * A promise used to ensure that only one request is in progress at a time. If
12
+ * a flush is called while a request is in progress, the flush will wait for
13
+ * the request to finish before starting a new one.
14
+ */
15
+ currentRequest = null;
16
+ /**
17
+ * The integration ID the logs will be associated with. If undefined, the
18
+ * logs will be buffered until the logger has been initialized.
19
+ */
20
+ integrationId = void 0;
21
+ /**
22
+ * The random ID for the integration log to which the logs will be appended.
23
+ */
24
+ integrationLogId;
25
+ /**
26
+ * Determines when the logger should flush the logs. Calling info(), error(),
27
+ * warn(), indent() or dedent() will automatically flush the logs if the last
28
+ * flush was more than 1 second ago.
29
+ */
30
+ lastFlush = null;
31
+ /**
32
+ * A flag is used to determine whether a new log should be created when the
33
+ * logger is flushed. The first time the logger is flushed, a new log will be
34
+ * created. Subsequent flushes will append to the existing log.
35
+ */
36
+ logCreated = false;
37
+ /**
38
+ * A Console-like object with which messages will be logger.
39
+ */
40
+ logger;
41
+ /**
42
+ * Backlog of log messages that have not yet been sent to Worknice. The logs
43
+ * will be sent to the server when the logger is flushed and the backlog will
44
+ * be cleared.
45
+ */
46
+ logs = [];
47
+ /**
48
+ * Determines the current indentation level of the log messages. The indent()
49
+ * and dedent() functions can be used to increase or decrease the indentation
50
+ * level.
51
+ */
52
+ messageIndent = 0;
53
+ /**
54
+ * A logger can log messages to both a Console-like object and to a Worknice
55
+ * integration's logs which can be view by a Worknice user. By default,
56
+ * messages are only logged to the console, but when a Worknice integration is
57
+ * connected using the connect() method, the messages will also be logged to
58
+ * Worknice.
59
+ * @param logger A Console-like object with which messages can be logged.
60
+ * @example
61
+ * ```js
62
+ * const logger = new WorkniceIntegrationLogger(console);
63
+ * ```
64
+ */
65
+ constructor(logger) {
66
+ this.logger = logger ?? console;
67
+ this.integrationLogId = uuid();
68
+ }
69
+ /**
70
+ * Connects the logger to a Worknice integration. If there are previously
71
+ * logged messages that need to be flushed, a new integration log will be
72
+ * instantly created and the messages flushed to it. Otherwise, an integration
73
+ * log will be created if/when the first message is logged.
74
+ */
75
+ connect(client, integrationId) {
76
+ this.client = client;
77
+ this.integrationId = integrationId;
78
+ if (this.lastFlush === null || Temporal.Now.instant().since(this.lastFlush).seconds >= 1) {
79
+ this.flush();
80
+ }
81
+ }
82
+ /**
83
+ * Logs a debug message. Debug messages are only logged to the console and are
84
+ * never append to the Worknice integration logs.
85
+ */
86
+ debug(message) {
87
+ this.logger.debug(message);
88
+ }
89
+ dedent(message) {
90
+ if (message !== void 0) this.info(message);
91
+ if (this.logger.groupEnd) this.logger.groupEnd();
92
+ this.messageIndent = Math.max(0, this.messageIndent - 1);
93
+ }
94
+ enqueue(message) {
95
+ this.logs.push({
96
+ time: Temporal.Now.instant(),
97
+ message: message.split("\n").map((line) => `${" ".repeat(this.messageIndent * 2)}${line}`).join("\n")
98
+ });
99
+ if (this.lastFlush === null || Temporal.Now.instant().since(this.lastFlush).seconds >= 1) {
100
+ this.flush();
101
+ }
102
+ }
103
+ error(message) {
104
+ this.logger.error(message);
105
+ this.enqueue(message);
106
+ }
107
+ /**
108
+ * Flushes the log buffer to the server. The info() function will
109
+ * automatically flush the logs if the last flush was more than 1 second
110
+ * ago, but the flush() function should be called manually at the end of the
111
+ * script to ensure that all logs are sent to the server.
112
+ */
113
+ async flush() {
114
+ if (this.currentRequest) await this.currentRequest;
115
+ if (this.logs.length === 0 || this.client === null || this.integrationId === null) return;
116
+ this.lastFlush = Temporal.Now.instant();
117
+ const entries = this.logs.splice(0).map(({ time, message }) => ({
118
+ time: time.toString({ timeZone: "Australia/Sydney", smallestUnit: "second" }),
119
+ message
120
+ }));
121
+ this.currentRequest = this.client.fetchFromApi(
122
+ gql`
123
+ mutation AppendIntegrationLog(
124
+ $createNewLog: Boolean!
125
+ $entries: [IntegrationLogInput!]!
126
+ $integrationId: ID!
127
+ $integrationLogId: ID!
128
+ ) {
129
+ createIntegrationLog(integrationId: $integrationId, integrationLogId: $integrationLogId)
130
+ @include(if: $createNewLog) {
131
+ id
132
+ }
133
+ appendIntegrationLog(integrationLogId: $integrationLogId, entries: $entries) {
134
+ id
135
+ }
136
+ }
137
+ `,
138
+ {
139
+ // Only create a new log the first time the logger is flushed.
140
+ createNewLog: this.logCreated === false,
141
+ entries,
142
+ integrationId: this.integrationId,
143
+ integrationLogId: this.integrationLogId
144
+ }
145
+ );
146
+ this.logCreated = true;
147
+ await this.currentRequest;
148
+ this.currentRequest = null;
149
+ }
150
+ indent(message) {
151
+ if (message !== void 0) this.info(message);
152
+ if (this.logger.group) this.logger.group();
153
+ this.messageIndent += 1;
154
+ }
155
+ /**
156
+ * Logs an informational message. The message will be appended to the log
157
+ * buffer and flushed to the server if the last flush was more than 1 second
158
+ * ago.
159
+ */
160
+ info(message) {
161
+ this.logger.info(message);
162
+ this.enqueue(message);
163
+ }
164
+ warn(message) {
165
+ this.logger.warn(message);
166
+ this.enqueue(message);
167
+ }
168
+ }
169
+ var WorkniceIntegrationLogger_default = WorkniceIntegrationLogger;
170
+ export {
171
+ WorkniceIntegrationLogger_default as default
172
+ };
173
+ //# sourceMappingURL=WorkniceIntegrationLogger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/WorkniceIntegrationLogger.ts"],"sourcesContent":["import gql from \"dedent\";\nimport { Temporal } from \"temporal-polyfill\";\nimport { v4 as uuid } from \"uuid\";\nimport type { WorkniceClient } from \"./_types.js\";\n\nexport type Logger = Pick<Console, \"debug\" | \"error\" | \"info\" | \"warn\"> &\n Partial<Pick<Console, \"group\" | \"groupEnd\">>;\n\nclass WorkniceIntegrationLogger {\n /**\n * The Worknice client used to send the logs to the server. If null, the logs\n * will be buffered until the logger is initialized.\n */\n private client: WorkniceClient | null = null;\n\n /**\n * A promise used to ensure that only one request is in progress at a time. If\n * a flush is called while a request is in progress, the flush will wait for\n * the request to finish before starting a new one.\n */\n private currentRequest: Promise<unknown> | null = null;\n\n /**\n * The integration ID the logs will be associated with. If undefined, the\n * logs will be buffered until the logger has been initialized.\n */\n private integrationId: string | undefined = undefined;\n\n /**\n * The random ID for the integration log to which the logs will be appended.\n */\n private integrationLogId: string;\n\n /**\n * Determines when the logger should flush the logs. Calling info(), error(),\n * warn(), indent() or dedent() will automatically flush the logs if the last\n * flush was more than 1 second ago.\n */\n private lastFlush: Temporal.Instant | null = null;\n\n /**\n * A flag is used to determine whether a new log should be created when the\n * logger is flushed. The first time the logger is flushed, a new log will be\n * created. Subsequent flushes will append to the existing log.\n */\n private logCreated = false;\n\n /**\n * A Console-like object with which messages will be logger.\n */\n private logger: Logger;\n\n /**\n * Backlog of log messages that have not yet been sent to Worknice. The logs\n * will be sent to the server when the logger is flushed and the backlog will\n * be cleared.\n */\n private logs: Array<{ time: Temporal.Instant; message: string }> = [];\n\n /**\n * Determines the current indentation level of the log messages. The indent()\n * and dedent() functions can be used to increase or decrease the indentation\n * level.\n */\n private messageIndent = 0;\n\n /**\n * A logger can log messages to both a Console-like object and to a Worknice\n * integration's logs which can be view by a Worknice user. By default,\n * messages are only logged to the console, but when a Worknice integration is\n * connected using the connect() method, the messages will also be logged to\n * Worknice.\n * @param logger A Console-like object with which messages can be logged.\n * @example\n * ```js\n * const logger = new WorkniceIntegrationLogger(console);\n * ```\n */\n constructor(logger?: Logger) {\n this.logger = logger ?? console;\n this.integrationLogId = uuid();\n }\n\n /**\n * Connects the logger to a Worknice integration. If there are previously\n * logged messages that need to be flushed, a new integration log will be\n * instantly created and the messages flushed to it. Otherwise, an integration\n * log will be created if/when the first message is logged.\n */\n public connect(client: WorkniceClient, integrationId: string) {\n this.client = client;\n this.integrationId = integrationId;\n if (this.lastFlush === null || Temporal.Now.instant().since(this.lastFlush).seconds >= 1) {\n this.flush();\n }\n }\n\n /**\n * Logs a debug message. Debug messages are only logged to the console and are\n * never append to the Worknice integration logs.\n */\n public debug(message: string) {\n this.logger.debug(message);\n }\n\n public dedent(message?: string) {\n if (message !== undefined) this.info(message);\n if (this.logger.groupEnd) this.logger.groupEnd();\n this.messageIndent = Math.max(0, this.messageIndent - 1);\n }\n\n private enqueue(message: string) {\n this.logs.push({\n time: Temporal.Now.instant(),\n message: message\n .split(\"\\n\")\n .map((line) => `${\" \".repeat(this.messageIndent * 2)}${line}`)\n .join(\"\\n\"),\n });\n\n if (this.lastFlush === null || Temporal.Now.instant().since(this.lastFlush).seconds >= 1) {\n this.flush();\n }\n }\n\n public error(message: string) {\n this.logger.error(message);\n this.enqueue(message);\n }\n\n /**\n * Flushes the log buffer to the server. The info() function will\n * automatically flush the logs if the last flush was more than 1 second\n * ago, but the flush() function should be called manually at the end of the\n * script to ensure that all logs are sent to the server.\n */\n public async flush() {\n // If there's already a request in progress, wait for it to finish before\n // starting a new one.\n if (this.currentRequest) await this.currentRequest;\n\n // If there are no pending logs or the logger hasn't been initialized,\n // don't do anything (any logs will remain in the buffer until the next\n // flush).\n if (this.logs.length === 0 || this.client === null || this.integrationId === null) return;\n\n this.lastFlush = Temporal.Now.instant();\n\n const entries = this.logs.splice(0).map(({ time, message }) => ({\n time: time.toString({ timeZone: \"Australia/Sydney\", smallestUnit: \"second\" }),\n message,\n }));\n\n this.currentRequest = this.client.fetchFromApi(\n gql`\n mutation AppendIntegrationLog(\n $createNewLog: Boolean!\n $entries: [IntegrationLogInput!]!\n $integrationId: ID!\n $integrationLogId: ID!\n ) {\n createIntegrationLog(integrationId: $integrationId, integrationLogId: $integrationLogId)\n @include(if: $createNewLog) {\n id\n }\n appendIntegrationLog(integrationLogId: $integrationLogId, entries: $entries) {\n id\n }\n }\n `,\n {\n // Only create a new log the first time the logger is flushed.\n createNewLog: this.logCreated === false,\n entries,\n integrationId: this.integrationId,\n integrationLogId: this.integrationLogId,\n },\n );\n\n // Only create a new log the first time the logger is flushed.\n this.logCreated = true;\n\n await this.currentRequest;\n\n // Clear the request promise so that the next flush can start a new request.\n this.currentRequest = null;\n }\n\n public indent(message?: string) {\n if (message !== undefined) this.info(message);\n if (this.logger.group) this.logger.group();\n this.messageIndent += 1;\n }\n\n /**\n * Logs an informational message. The message will be appended to the log\n * buffer and flushed to the server if the last flush was more than 1 second\n * ago.\n */\n public info(message: string) {\n this.logger.info(message);\n this.enqueue(message);\n }\n\n public warn(message: string) {\n this.logger.warn(message);\n this.enqueue(message);\n }\n}\n\nexport default WorkniceIntegrationLogger;\n"],"mappings":"AAAA,OAAO,SAAS;AAChB,SAAS,gBAAgB;AACzB,SAAS,MAAM,YAAY;AAM3B,MAAM,0BAA0B;AAAA;AAAA;AAAA;AAAA;AAAA,EAKtB,SAAgC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOhC,iBAA0C;AAAA;AAAA;AAAA;AAAA;AAAA,EAM1C,gBAAoC;AAAA;AAAA;AAAA;AAAA,EAKpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,YAAqC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOrC,aAAa;AAAA;AAAA;AAAA;AAAA,EAKb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAA2D,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO5D,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcxB,YAAY,QAAiB;AAC3B,SAAK,SAAS,UAAU;AACxB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