@envoy/envoy-integrations-sdk 2.0.1-beta.5 → 2.0.2

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 (291) hide show
  1. package/README.md +178 -110
  2. package/dist/base/EnvoyAPI.d.ts +28 -0
  3. package/dist/base/EnvoyAPI.d.ts.map +1 -0
  4. package/dist/base/EnvoyAPI.js +121 -0
  5. package/dist/base/EnvoyPluginStoragePipeline.d.ts +51 -0
  6. package/dist/base/EnvoyPluginStoragePipeline.d.ts.map +1 -0
  7. package/dist/base/EnvoyPluginStoragePipeline.js +140 -0
  8. package/dist/constants.d.ts +5 -0
  9. package/dist/constants.d.ts.map +1 -0
  10. package/dist/constants.js +12 -0
  11. package/dist/factories/entryEventBodyFactory.d.ts +42 -0
  12. package/dist/factories/entryEventBodyFactory.d.ts.map +1 -0
  13. package/dist/factories/entryEventBodyFactory.js +105 -0
  14. package/dist/factories/eventBodyFactory.d.ts +18 -0
  15. package/dist/factories/eventBodyFactory.d.ts.map +1 -0
  16. package/dist/factories/eventBodyFactory.js +15 -0
  17. package/dist/factories/inviteEventBodyFactory.d.ts +38 -0
  18. package/dist/factories/inviteEventBodyFactory.d.ts.map +1 -0
  19. package/dist/factories/inviteEventBodyFactory.js +92 -0
  20. package/dist/factories/metaFactory.d.ts +10 -0
  21. package/dist/factories/metaFactory.d.ts.map +1 -0
  22. package/dist/factories/metaFactory.js +90 -0
  23. package/dist/factories/routeBodyFactory.d.ts +19 -0
  24. package/dist/factories/routeBodyFactory.d.ts.map +1 -0
  25. package/dist/factories/routeBodyFactory.js +15 -0
  26. package/dist/index.d.ts +52 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +74 -0
  29. package/dist/internal/EnvoyEntryEvent.d.ts +3 -0
  30. package/dist/internal/EnvoyEntryEvent.d.ts.map +1 -0
  31. package/dist/internal/EnvoyEntryEvent.js +2 -0
  32. package/dist/internal/EnvoyInviteEvent.d.ts +3 -0
  33. package/dist/internal/EnvoyInviteEvent.d.ts.map +1 -0
  34. package/dist/internal/EnvoyInviteEvent.js +2 -0
  35. package/dist/internal/EnvoyLocationEvent.d.ts +3 -0
  36. package/dist/internal/EnvoyLocationEvent.d.ts.map +1 -0
  37. package/dist/internal/EnvoyLocationEvent.js +2 -0
  38. package/dist/internal/EnvoyOption.d.ts +6 -0
  39. package/dist/internal/EnvoyOption.d.ts.map +1 -0
  40. package/dist/internal/EnvoyOption.js +2 -0
  41. package/dist/internal/EnvoyOptionsRouteParams.d.ts +7 -0
  42. package/dist/internal/EnvoyOptionsRouteParams.d.ts.map +1 -0
  43. package/dist/internal/EnvoyOptionsRouteParams.js +2 -0
  44. package/dist/internal/EnvoyOptionsRouteResponseBody.d.ts +4 -0
  45. package/dist/internal/EnvoyOptionsRouteResponseBody.d.ts.map +1 -0
  46. package/dist/internal/EnvoyOptionsRouteResponseBody.js +2 -0
  47. package/dist/internal/EnvoyPluginJobUpdate.d.ts +11 -0
  48. package/dist/internal/EnvoyPluginJobUpdate.d.ts.map +1 -0
  49. package/dist/internal/EnvoyPluginJobUpdate.js +2 -0
  50. package/dist/internal/EnvoyRemoteValueRouteResponseBody.d.ts +5 -0
  51. package/dist/internal/EnvoyRemoteValueRouteResponseBody.d.ts.map +1 -0
  52. package/dist/internal/EnvoyRemoteValueRouteResponseBody.js +2 -0
  53. package/dist/internal/EnvoySelectedValuesRouteParams.d.ts +5 -0
  54. package/dist/internal/EnvoySelectedValuesRouteParams.d.ts.map +1 -0
  55. package/dist/internal/EnvoySelectedValuesRouteParams.js +2 -0
  56. package/dist/internal/EnvoySelectedValuesRouteResponseBody.d.ts +4 -0
  57. package/dist/internal/EnvoySelectedValuesRouteResponseBody.d.ts.map +1 -0
  58. package/dist/internal/EnvoySelectedValuesRouteResponseBody.js +2 -0
  59. package/dist/internal/EnvoyStorageCommand.d.ts +42 -0
  60. package/dist/internal/EnvoyStorageCommand.d.ts.map +1 -0
  61. package/dist/internal/EnvoyStorageCommand.js +7 -0
  62. package/dist/internal/EnvoyStorageResult.d.ts +4 -0
  63. package/dist/internal/EnvoyStorageResult.d.ts.map +1 -0
  64. package/dist/internal/EnvoyStorageResult.js +2 -0
  65. package/dist/internal/HttpStatus.d.ts +13 -0
  66. package/dist/internal/HttpStatus.d.ts.map +1 -0
  67. package/dist/internal/HttpStatus.js +15 -0
  68. package/dist/mocks/EnvoyPluginJobMock.d.ts +12 -0
  69. package/dist/mocks/EnvoyPluginJobMock.d.ts.map +1 -0
  70. package/dist/mocks/EnvoyPluginJobMock.js +60 -0
  71. package/dist/mocks/EnvoyPluginStoragePipelineMock.d.ts +24 -0
  72. package/dist/mocks/EnvoyPluginStoragePipelineMock.d.ts.map +1 -0
  73. package/dist/mocks/EnvoyPluginStoragePipelineMock.js +212 -0
  74. package/dist/payloads/EntryPayload.d.ts +80 -0
  75. package/dist/payloads/EntryPayload.d.ts.map +1 -0
  76. package/dist/payloads/EntryPayload.js +28 -0
  77. package/dist/payloads/InvitePayload.d.ts +66 -0
  78. package/dist/payloads/InvitePayload.d.ts.map +1 -0
  79. package/dist/payloads/InvitePayload.js +24 -0
  80. package/dist/payloads/LocationPayload.d.ts +7 -0
  81. package/dist/payloads/LocationPayload.d.ts.map +1 -0
  82. package/dist/payloads/LocationPayload.js +2 -0
  83. package/dist/payloads/NotificationPayload.d.ts +54 -0
  84. package/dist/payloads/NotificationPayload.d.ts.map +1 -0
  85. package/dist/payloads/NotificationPayload.js +2 -0
  86. package/dist/resources/AgreementPageResource.d.ts +17 -0
  87. package/dist/resources/AgreementPageResource.d.ts.map +1 -0
  88. package/dist/resources/AgreementPageResource.js +2 -0
  89. package/dist/resources/AgreementResource.d.ts +24 -0
  90. package/dist/resources/AgreementResource.d.ts.map +1 -0
  91. package/dist/resources/AgreementResource.js +2 -0
  92. package/dist/resources/CompanyResource.d.ts +19 -0
  93. package/dist/resources/CompanyResource.d.ts.map +1 -0
  94. package/dist/resources/CompanyResource.js +2 -0
  95. package/dist/resources/CompanyRoleResource.d.ts +8 -0
  96. package/dist/resources/CompanyRoleResource.d.ts.map +1 -0
  97. package/dist/resources/CompanyRoleResource.js +2 -0
  98. package/dist/resources/CurrentUserResource.d.ts +8 -0
  99. package/dist/resources/CurrentUserResource.d.ts.map +1 -0
  100. package/dist/resources/CurrentUserResource.js +2 -0
  101. package/dist/resources/EmployeeResource.d.ts +43 -0
  102. package/dist/resources/EmployeeResource.d.ts.map +1 -0
  103. package/dist/resources/EmployeeResource.js +2 -0
  104. package/dist/resources/FlowResource.d.ts +31 -0
  105. package/dist/resources/FlowResource.d.ts.map +1 -0
  106. package/dist/resources/FlowResource.js +2 -0
  107. package/dist/resources/InviteResource.d.ts +86 -0
  108. package/dist/resources/InviteResource.d.ts.map +1 -0
  109. package/dist/resources/InviteResource.js +2 -0
  110. package/dist/resources/LocationResource.d.ts +64 -0
  111. package/dist/resources/LocationResource.d.ts.map +1 -0
  112. package/dist/resources/LocationResource.js +2 -0
  113. package/dist/resources/LocationRoleResource.d.ts +8 -0
  114. package/dist/resources/LocationRoleResource.d.ts.map +1 -0
  115. package/dist/resources/LocationRoleResource.js +2 -0
  116. package/dist/resources/SignInFieldPageResource.d.ts +17 -0
  117. package/dist/resources/SignInFieldPageResource.d.ts.map +1 -0
  118. package/dist/resources/SignInFieldPageResource.js +2 -0
  119. package/dist/resources/SignInFieldResource.d.ts +33 -0
  120. package/dist/resources/SignInFieldResource.d.ts.map +1 -0
  121. package/dist/resources/SignInFieldResource.js +2 -0
  122. package/dist/resources/UserResource.d.ts +13 -0
  123. package/dist/resources/UserResource.d.ts.map +1 -0
  124. package/dist/resources/UserResource.js +2 -0
  125. package/dist/sdk/EnvoyMeta.d.ts +96 -0
  126. package/dist/sdk/EnvoyMeta.d.ts.map +1 -0
  127. package/dist/sdk/EnvoyMeta.js +2 -0
  128. package/dist/sdk/EnvoyPluginAPI.d.ts +31 -0
  129. package/dist/sdk/EnvoyPluginAPI.d.ts.map +1 -0
  130. package/dist/sdk/EnvoyPluginAPI.js +205 -0
  131. package/dist/sdk/EnvoyPluginJob.d.ts +49 -0
  132. package/dist/sdk/EnvoyPluginJob.d.ts.map +1 -0
  133. package/dist/sdk/EnvoyPluginJob.js +99 -0
  134. package/dist/sdk/EnvoyPluginJobAttachment.d.ts +43 -0
  135. package/dist/sdk/EnvoyPluginJobAttachment.d.ts.map +1 -0
  136. package/dist/sdk/EnvoyPluginJobAttachment.js +2 -0
  137. package/dist/sdk/EnvoyPluginSDK.d.ts +100 -0
  138. package/dist/sdk/EnvoyPluginSDK.d.ts.map +1 -0
  139. package/dist/sdk/EnvoyPluginSDK.js +204 -0
  140. package/dist/sdk/EnvoyPluginStorage.d.ts +69 -0
  141. package/dist/sdk/EnvoyPluginStorage.d.ts.map +1 -0
  142. package/dist/sdk/EnvoyPluginStorage.js +78 -0
  143. package/dist/sdk/EnvoyRequest.d.ts +116 -0
  144. package/dist/sdk/EnvoyRequest.d.ts.map +1 -0
  145. package/dist/sdk/EnvoyRequest.js +7 -0
  146. package/dist/sdk/EnvoyResponse.d.ts +42 -0
  147. package/dist/sdk/EnvoyResponse.d.ts.map +1 -0
  148. package/dist/sdk/EnvoyResponse.js +2 -0
  149. package/dist/sdk/EnvoyStorageItem.d.ts +9 -0
  150. package/dist/sdk/EnvoyStorageItem.d.ts.map +1 -0
  151. package/dist/sdk/EnvoyStorageItem.js +2 -0
  152. package/dist/sdk/EnvoyUserAPI.d.ts +119 -0
  153. package/dist/sdk/EnvoyUserAPI.d.ts.map +1 -0
  154. package/dist/sdk/EnvoyUserAPI.js +493 -0
  155. package/dist/sdk/filters.d.ts +30 -0
  156. package/dist/sdk/filters.d.ts.map +1 -0
  157. package/dist/sdk/filters.js +72 -0
  158. package/dist/sdk/handlers.d.ts +125 -0
  159. package/dist/sdk/handlers.d.ts.map +1 -0
  160. package/dist/sdk/handlers.js +108 -0
  161. package/dist/sdk/loggers.d.ts +6 -0
  162. package/dist/sdk/loggers.d.ts.map +1 -0
  163. package/dist/sdk/loggers.js +161 -0
  164. package/dist/sdk/middleware.d.ts +19 -0
  165. package/dist/sdk/middleware.d.ts.map +1 -0
  166. package/dist/sdk/middleware.js +159 -0
  167. package/dist/util/EnvoyJWT.d.ts +17 -0
  168. package/dist/util/EnvoyJWT.d.ts.map +1 -0
  169. package/dist/util/EnvoyJWT.js +54 -0
  170. package/dist/util/EnvoySignatureVerifier.d.ts +26 -0
  171. package/dist/util/EnvoySignatureVerifier.d.ts.map +1 -0
  172. package/dist/util/EnvoySignatureVerifier.js +53 -0
  173. package/dist/util/axiosConstructor.d.ts +4 -0
  174. package/dist/util/axiosConstructor.d.ts.map +1 -0
  175. package/dist/util/axiosConstructor.js +58 -0
  176. package/dist/util/errorHandling.d.ts +2 -0
  177. package/dist/util/errorHandling.d.ts.map +1 -0
  178. package/dist/util/errorHandling.js +18 -0
  179. package/dist/util/json-api/JSONAPIData.d.ts +5 -0
  180. package/dist/util/json-api/JSONAPIData.d.ts.map +1 -0
  181. package/dist/util/json-api/JSONAPIData.js +2 -0
  182. package/dist/util/json-api/JSONAPIFilterParams.d.ts +5 -0
  183. package/dist/util/json-api/JSONAPIFilterParams.d.ts.map +1 -0
  184. package/dist/util/json-api/JSONAPIFilterParams.js +2 -0
  185. package/dist/util/json-api/JSONAPIModel.d.ts +10 -0
  186. package/dist/util/json-api/JSONAPIModel.d.ts.map +1 -0
  187. package/dist/util/json-api/JSONAPIModel.js +2 -0
  188. package/dist/util/json-api/JSONAPIPaginationParams.d.ts +9 -0
  189. package/dist/util/json-api/JSONAPIPaginationParams.d.ts.map +1 -0
  190. package/dist/util/json-api/JSONAPIPaginationParams.js +2 -0
  191. package/dist/util/json-api/JSONAPIParams.d.ts +4 -0
  192. package/dist/util/json-api/JSONAPIParams.d.ts.map +1 -0
  193. package/dist/util/json-api/JSONAPIParams.js +2 -0
  194. package/dist/util/json-api/JSONAPIResponse.d.ts +6 -0
  195. package/dist/util/json-api/JSONAPIResponse.d.ts.map +1 -0
  196. package/dist/util/json-api/JSONAPIResponse.js +2 -0
  197. package/package.json +48 -13
  198. package/src/base/EnvoyAPI.ts +87 -0
  199. package/src/base/EnvoyPluginStoragePipeline.ts +99 -0
  200. package/src/constants.ts +7 -0
  201. package/src/factories/entryEventBodyFactory.ts +124 -0
  202. package/src/factories/eventBodyFactory.ts +35 -0
  203. package/src/factories/inviteEventBodyFactory.ts +107 -0
  204. package/src/factories/metaFactory.ts +109 -0
  205. package/src/factories/routeBodyFactory.ts +37 -0
  206. package/src/index.ts +86 -0
  207. package/src/internal/EnvoyEntryEvent.ts +10 -0
  208. package/src/internal/EnvoyInviteEvent.ts +13 -0
  209. package/src/internal/EnvoyLocationEvent.ts +3 -0
  210. package/src/internal/EnvoyOption.ts +6 -0
  211. package/src/internal/EnvoyOptionsRouteParams.ts +7 -0
  212. package/src/internal/EnvoyOptionsRouteResponseBody.ts +4 -0
  213. package/src/internal/EnvoyPluginJobUpdate.ts +11 -0
  214. package/src/internal/EnvoyRemoteValueRouteResponseBody.ts +4 -0
  215. package/src/internal/EnvoySelectedValuesRouteParams.ts +5 -0
  216. package/src/internal/EnvoySelectedValuesRouteResponseBody.ts +4 -0
  217. package/src/internal/EnvoyStorageCommand.ts +60 -0
  218. package/src/internal/EnvoyStorageResult.ts +5 -0
  219. package/src/internal/HttpStatus.ts +12 -0
  220. package/src/mocks/EnvoyPluginJobMock.ts +33 -0
  221. package/src/mocks/EnvoyPluginStoragePipelineMock.ts +204 -0
  222. package/src/payloads/EntryPayload.ts +101 -0
  223. package/src/payloads/InvitePayload.ts +79 -0
  224. package/src/payloads/LocationPayload.ts +8 -0
  225. package/src/payloads/NotificationPayload.ts +54 -0
  226. package/src/resources/AgreementPageResource.ts +19 -0
  227. package/src/resources/AgreementResource.ts +26 -0
  228. package/src/resources/CompanyResource.ts +21 -0
  229. package/src/resources/CompanyRoleResource.ts +10 -0
  230. package/src/resources/CurrentUserResource.ts +10 -0
  231. package/src/resources/EmployeeResource.ts +47 -0
  232. package/src/resources/FlowResource.ts +35 -0
  233. package/src/resources/InviteResource.ts +92 -0
  234. package/src/resources/LocationResource.ts +68 -0
  235. package/src/resources/LocationRoleResource.ts +10 -0
  236. package/src/resources/SignInFieldPageResource.ts +23 -0
  237. package/src/resources/SignInFieldResource.ts +35 -0
  238. package/src/resources/UserResource.ts +14 -0
  239. package/src/sdk/EnvoyMeta.ts +101 -0
  240. package/src/sdk/EnvoyPluginAPI.ts +95 -0
  241. package/src/sdk/EnvoyPluginJob.ts +90 -0
  242. package/src/sdk/EnvoyPluginJobAttachment.ts +48 -0
  243. package/src/sdk/EnvoyPluginSDK.ts +185 -0
  244. package/src/sdk/EnvoyPluginStorage.ts +83 -0
  245. package/src/sdk/EnvoyRequest.ts +145 -0
  246. package/src/sdk/EnvoyResponse.ts +46 -0
  247. package/src/sdk/EnvoyStorageItem.ts +9 -0
  248. package/src/sdk/EnvoyUserAPI.ts +339 -0
  249. package/src/sdk/filters.ts +96 -0
  250. package/src/sdk/handlers.ts +234 -0
  251. package/src/sdk/loggers.ts +165 -0
  252. package/src/sdk/middleware.ts +101 -0
  253. package/src/util/EnvoyJWT.ts +51 -0
  254. package/src/util/EnvoySignatureVerifier.ts +61 -0
  255. package/src/util/axiosConstructor.ts +46 -0
  256. package/src/util/errorHandling.ts +15 -0
  257. package/src/util/json-api/JSONAPIData.ts +4 -0
  258. package/src/util/json-api/JSONAPIFilterParams.ts +5 -0
  259. package/src/util/json-api/JSONAPIModel.ts +10 -0
  260. package/src/util/json-api/JSONAPIPaginationParams.ts +12 -0
  261. package/src/util/json-api/JSONAPIParams.ts +3 -0
  262. package/src/util/json-api/JSONAPIResponse.ts +5 -0
  263. package/.eslintrc.js +0 -46
  264. package/.github/workflows/package.yaml +0 -43
  265. package/.github/workflows/test.yaml +0 -15
  266. package/asynchandler.md +0 -46
  267. package/envoyapi.md +0 -150
  268. package/envoyjwt.md +0 -46
  269. package/envoypluginjob.md +0 -106
  270. package/envoypluginsdk.md +0 -87
  271. package/envoypluginstorage.md +0 -95
  272. package/envoypluginstoragepipeline.md +0 -125
  273. package/envoysignatureverifier.md +0 -43
  274. package/errormiddleware.md +0 -41
  275. package/index.js +0 -49
  276. package/lib/EnvoyAPI.js +0 -564
  277. package/lib/EnvoyJWT.js +0 -72
  278. package/lib/EnvoyPluginJob.js +0 -124
  279. package/lib/EnvoyPluginSDK.js +0 -192
  280. package/lib/EnvoyPluginStorage.js +0 -121
  281. package/lib/EnvoyPluginStoragePipeline.js +0 -155
  282. package/lib/EnvoyResponseError.js +0 -18
  283. package/lib/EnvoySignatureVerifier.js +0 -67
  284. package/lib/HttpStatus.js +0 -20
  285. package/lib/asyncHandler.js +0 -17
  286. package/lib/axios.js +0 -34
  287. package/lib/errorMiddleware.js +0 -27
  288. package/lib/middleware.js +0 -110
  289. package/middleware.md +0 -53
  290. package/test/axios.test.js +0 -57
  291. package/test/promises.test.js +0 -82
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ /**
15
+ * A "job" is an event, like `entry_sign_in`.
16
+ * When your plugin handles the event, you can use this job concept
17
+ * to update the status (e.g. complete, failed, ignored)
18
+ * as well as attach extra data to the event's subject
19
+ * (e.g. showing a generated card number in the dashboard for a visitor on `entry_sign_in`).
20
+ *
21
+ * @category Request Object
22
+ */
23
+ var EnvoyPluginJob = /** @class */ (function () {
24
+ function EnvoyPluginJob(pluginAPI, jobId) {
25
+ this.api = pluginAPI;
26
+ this.id = jobId;
27
+ }
28
+ EnvoyPluginJob.prototype.execute = function (status, message, reason, attachments) {
29
+ if (attachments === void 0) { attachments = []; }
30
+ var updates = {
31
+ attachments: attachments.map(function (attachment) { return (__assign({ type: 'text' }, attachment)); }),
32
+ };
33
+ if (status) {
34
+ Object.assign(updates, { status: status });
35
+ }
36
+ if (message) {
37
+ Object.assign(updates, { status_message: message });
38
+ }
39
+ if (reason) {
40
+ Object.assign(updates, { failure_reason: reason });
41
+ }
42
+ return this.api.updateJob(this.id, updates);
43
+ };
44
+ /**
45
+ * Add attachments to this job.
46
+ */
47
+ EnvoyPluginJob.prototype.attach = function () {
48
+ var attachments = [];
49
+ for (var _i = 0; _i < arguments.length; _i++) {
50
+ attachments[_i] = arguments[_i];
51
+ }
52
+ return this.execute(null, null, null, attachments);
53
+ };
54
+ /**
55
+ * Reports that the job is complete.
56
+ *
57
+ * Instead of calling this directly, you can return a 200 response from the job's event handler,
58
+ * using {@link EnvoyRequest.send}.
59
+ */
60
+ EnvoyPluginJob.prototype.complete = function (message) {
61
+ var attachments = [];
62
+ for (var _i = 1; _i < arguments.length; _i++) {
63
+ attachments[_i - 1] = arguments[_i];
64
+ }
65
+ return this.execute('done', message, null, attachments);
66
+ };
67
+ /**
68
+ * Reports that the job is ignored.
69
+ *
70
+ * Instead of calling this directly, you can return a 400 response from the job's event handler,
71
+ * using {@link EnvoyRequest.sendIgnored}.
72
+ */
73
+ EnvoyPluginJob.prototype.ignore = function (message, reason) {
74
+ return this.execute('ignored', message, reason);
75
+ };
76
+ /**
77
+ * Reports that the job is ignored.
78
+ *
79
+ * Instead of calling this directly, you can return a 400 response from the job's event handler,
80
+ * using {@link EnvoyRequest.sendFailed}.
81
+ */
82
+ EnvoyPluginJob.prototype.fail = function (message, reason) {
83
+ return this.execute('failed', message, reason);
84
+ };
85
+ /**
86
+ * Updates the job with a new message and attachments.
87
+ *
88
+ * Can be used to periodically update long-running jobs.
89
+ */
90
+ EnvoyPluginJob.prototype.update = function (message) {
91
+ var attachments = [];
92
+ for (var _i = 1; _i < arguments.length; _i++) {
93
+ attachments[_i - 1] = arguments[_i];
94
+ }
95
+ return this.execute(null, message, null, attachments);
96
+ };
97
+ return EnvoyPluginJob;
98
+ }());
99
+ exports.default = EnvoyPluginJob;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Display some text in Envoy's dashboard.
3
+ *
4
+ * @category Attachment
5
+ */
6
+ export interface EnvoyPluginTextJobAttachment {
7
+ type?: 'text' | 'password' | string;
8
+ label: string;
9
+ value: string;
10
+ }
11
+ /**
12
+ * Display a link in Envoy's dashboard.
13
+ *
14
+ * @category Attachment
15
+ */
16
+ export interface EnvoyPluginLinkJobAttachment extends EnvoyPluginTextJobAttachment {
17
+ type: 'link';
18
+ url: string;
19
+ }
20
+ /**
21
+ * Display a credential in Envoy's dashboard,
22
+ * and include the credential's image in the invitee's welcome email.
23
+ *
24
+ * @category Attachment
25
+ */
26
+ export interface EnvoyPluginCredentialJobAttachment extends EnvoyPluginTextJobAttachment {
27
+ type: 'credential_image';
28
+ title: string;
29
+ image: {
30
+ type: 's3';
31
+ link: string;
32
+ };
33
+ }
34
+ /**
35
+ * Attachments to jobs, which will be displayed in the Envoy dashboard.
36
+ * Some attachments like `credential_image` can show up in other places,
37
+ * like an invitee's welcome email.
38
+ *
39
+ * @category Attachment
40
+ */
41
+ declare type EnvoyPluginJobAttachment = EnvoyPluginTextJobAttachment | EnvoyPluginLinkJobAttachment | EnvoyPluginCredentialJobAttachment;
42
+ export default EnvoyPluginJobAttachment;
43
+ //# sourceMappingURL=EnvoyPluginJobAttachment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnvoyPluginJobAttachment.d.ts","sourceRoot":"","sources":["../../src/sdk/EnvoyPluginJobAttachment.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC3C,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,4BAA6B,SAAQ,4BAA4B;IAChF,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;GAKG;AACH,MAAM,WAAW,kCAAmC,SAAQ,4BAA4B;IACtF,IAAI,EAAE,kBAAkB,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE;QACL,IAAI,EAAE,IAAI,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED;;;;;;GAMG;AACH,aAAK,wBAAwB,GAAG,4BAA4B,GAC1D,4BAA4B,GAC5B,kCAAkC,CAAC;AAErC,eAAe,wBAAwB,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,100 @@
1
+ import EnvoyPluginStorage from './EnvoyPluginStorage';
2
+ import EnvoyPluginJob from './EnvoyPluginJob';
3
+ import EnvoyJWT from '../util/EnvoyJWT';
4
+ import EnvoyUserAPI from './EnvoyUserAPI';
5
+ import EnvoyPluginAPI from './EnvoyPluginAPI';
6
+ /**
7
+ * Every Envoy request has a `meta` and `payload`.
8
+ * @category Request
9
+ */
10
+ export interface EnvoyRequestBody<Meta, Payload> {
11
+ meta: Meta;
12
+ payload: Payload;
13
+ }
14
+ /**
15
+ * Sets up all relevant Envoy functions.
16
+ * Attaches itself to every request object using our {@link middleware},
17
+ * to allow for easy access to Envoy functions.
18
+ *
19
+ * @category SDK
20
+ */
21
+ export default class EnvoyPluginSDK<Meta = unknown, Payload = unknown> {
22
+ /**
23
+ * Body of the request.
24
+ * use `meta` or `payload` to access the relevant properties,
25
+ * instead of this directly.
26
+ */
27
+ private readonly body;
28
+ /**
29
+ * Verified that the request comes from Envoy.
30
+ */
31
+ private readonly isVerified;
32
+ /**
33
+ * The internally managed plugin access token.
34
+ * Use the `pluginAPI` instead of this directly.
35
+ */
36
+ private readonly pluginAccessToken;
37
+ /**
38
+ * Don't create an instance of this class directly.
39
+ *
40
+ * Instead, use {@link middleware} to automatically attach an instance to `req` on every request.
41
+ * @param body - Request body
42
+ * @param isVerified - If the request has been verified via {@link EnvoySignatureVerifier}
43
+ * @param pluginAccessToken - An access token from {@link EnvoyPluginAPI.loginAsPlugin}
44
+ */
45
+ constructor(body: EnvoyRequestBody<Meta, Payload>, isVerified?: boolean, pluginAccessToken?: string | null);
46
+ /**
47
+ * The metadata for the request.
48
+ * Either an {@link EnvoyEventMeta}} or {@link EnvoyRouteMeta}.
49
+ */
50
+ get meta(): Meta;
51
+ /**
52
+ * The payload for the request.
53
+ * For events, it's some Envoy event payload, like an {@link EntryPayload} or {@link InvitePayload}.
54
+ * For setup step validation URLs, it's the form submitted values for a validation URL.
55
+ */
56
+ get payload(): Payload;
57
+ /**
58
+ * Envoy API scoped to the user.
59
+ * Used only in routes.
60
+ */
61
+ get userAPI(): EnvoyUserAPI;
62
+ /**
63
+ * Envoy API scoped to the plugin.
64
+ * Used to perform storage or job operations.
65
+ */
66
+ get pluginAPI(): EnvoyPluginAPI;
67
+ /**
68
+ * A function that returns an instance of EnvoyPluginStorage,
69
+ * optionally scoped to an install ID.
70
+ *
71
+ * Use {@link installStorage} or {@link globalStorage} instead of this directly.
72
+ */
73
+ private get getStorage();
74
+ /**
75
+ * Storage scoped to the install.
76
+ */
77
+ get installStorage(): EnvoyPluginStorage;
78
+ /**
79
+ * Storage scoped globally (across installs).
80
+ */
81
+ get globalStorage(): EnvoyPluginStorage;
82
+ /**
83
+ * Returns a job based on an ID.
84
+ */
85
+ get getJob(): (jobId: string) => EnvoyPluginJob;
86
+ /**
87
+ * Returns the current job's ID.
88
+ */
89
+ get jobId(): string | null;
90
+ /**
91
+ * Perform operations on the current job.
92
+ */
93
+ get job(): EnvoyPluginJob;
94
+ /**
95
+ * A utility to encode and decode JWTs.
96
+ * Useful for verifiable communications between plugin endpoints.
97
+ */
98
+ get jwt(): EnvoyJWT;
99
+ }
100
+ //# sourceMappingURL=EnvoyPluginSDK.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnvoyPluginSDK.d.ts","sourceRoot":"","sources":["../../src/sdk/EnvoyPluginSDK.ts"],"names":[],"mappings":"AACA,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,QAAQ,MAAM,kBAAkB,CAAC;AACxC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAK9C;;;GAGG;AACH,MAAM,WAAW,gBAAgB,CAAC,IAAI,EAAE,OAAO;IAC7C,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,cAAc,CAAC,IAAI,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO;IACnE;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAkC;IAEvD;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAU;IAErC;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAuB;IAEzD;;;;;;;OAOG;gBACS,IAAI,EAAE,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,UAAU,UAAQ,EAAE,iBAAiB,GAAE,MAAM,GAAG,IAAW;IAM9G;;;OAGG;IACH,IAAI,IAAI,IAAI,IAAI,CAKf;IAED;;;;OAIG;IACH,IAAI,OAAO,IAAI,OAAO,CAarB;IAED;;;OAGG;IACH,IAAI,OAAO,IAAI,YAAY,CAW1B;IAED;;;OAGG;IACH,IAAI,SAAS,IAAI,cAAc,CAM9B;IAED;;;;;OAKG;IACH,OAAO,KAAK,UAAU,GAErB;IAED;;OAEG;IACH,IAAI,cAAc,IAAI,kBAAkB,CAMvC;IAED;;OAEG;IACH,IAAI,aAAa,IAAI,kBAAkB,CAEtC;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,CAAC,KAAK,EAAE,MAAM,KAAK,cAAc,CAE9C;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,MAAM,GAAG,IAAI,CAMzB;IAED;;OAEG;IACH,IAAI,GAAG,IAAI,cAAc,CAMxB;IAED;;;OAGG;IAEH,IAAI,GAAG,IAAI,QAAQ,CAElB;CACF"}
@@ -0,0 +1,204 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ var EnvoyPluginStorage_1 = __importDefault(require("./EnvoyPluginStorage"));
7
+ var EnvoyPluginJob_1 = __importDefault(require("./EnvoyPluginJob"));
8
+ var EnvoyJWT_1 = __importDefault(require("../util/EnvoyJWT"));
9
+ var EnvoyUserAPI_1 = __importDefault(require("./EnvoyUserAPI"));
10
+ var EnvoyPluginAPI_1 = __importDefault(require("./EnvoyPluginAPI"));
11
+ var EntryPayload_1 = require("../payloads/EntryPayload");
12
+ var InvitePayload_1 = require("../payloads/InvitePayload");
13
+ /**
14
+ * Sets up all relevant Envoy functions.
15
+ * Attaches itself to every request object using our {@link middleware},
16
+ * to allow for easy access to Envoy functions.
17
+ *
18
+ * @category SDK
19
+ */
20
+ var EnvoyPluginSDK = /** @class */ (function () {
21
+ /**
22
+ * Don't create an instance of this class directly.
23
+ *
24
+ * Instead, use {@link middleware} to automatically attach an instance to `req` on every request.
25
+ * @param body - Request body
26
+ * @param isVerified - If the request has been verified via {@link EnvoySignatureVerifier}
27
+ * @param pluginAccessToken - An access token from {@link EnvoyPluginAPI.loginAsPlugin}
28
+ */
29
+ function EnvoyPluginSDK(body, isVerified, pluginAccessToken) {
30
+ if (isVerified === void 0) { isVerified = false; }
31
+ if (pluginAccessToken === void 0) { pluginAccessToken = null; }
32
+ /**
33
+ * The internally managed plugin access token.
34
+ * Use the `pluginAPI` instead of this directly.
35
+ */
36
+ this.pluginAccessToken = null;
37
+ this.body = body;
38
+ this.isVerified = isVerified;
39
+ this.pluginAccessToken = pluginAccessToken;
40
+ }
41
+ Object.defineProperty(EnvoyPluginSDK.prototype, "meta", {
42
+ /**
43
+ * The metadata for the request.
44
+ * Either an {@link EnvoyEventMeta}} or {@link EnvoyRouteMeta}.
45
+ */
46
+ get: function () {
47
+ if (!this.isVerified) {
48
+ throw new Error('Could not verify meta.');
49
+ }
50
+ return this.body.meta;
51
+ },
52
+ enumerable: false,
53
+ configurable: true
54
+ });
55
+ Object.defineProperty(EnvoyPluginSDK.prototype, "payload", {
56
+ /**
57
+ * The payload for the request.
58
+ * For events, it's some Envoy event payload, like an {@link EntryPayload} or {@link InvitePayload}.
59
+ * For setup step validation URLs, it's the form submitted values for a validation URL.
60
+ */
61
+ get: function () {
62
+ if (!this.isVerified) {
63
+ throw new Error('Could not verify payload.');
64
+ }
65
+ var payload = this.body.payload;
66
+ switch (payload.type) {
67
+ case 'entries':
68
+ return EntryPayload_1.normalizeEntryPayload(payload);
69
+ case 'invites':
70
+ return InvitePayload_1.normalizeInvitePayload(payload);
71
+ default:
72
+ return payload;
73
+ }
74
+ },
75
+ enumerable: false,
76
+ configurable: true
77
+ });
78
+ Object.defineProperty(EnvoyPluginSDK.prototype, "userAPI", {
79
+ /**
80
+ * Envoy API scoped to the user.
81
+ * Used only in routes.
82
+ */
83
+ get: function () {
84
+ var meta = this.meta;
85
+ var auth = meta.auth;
86
+ var accessToken = auth === null || auth === void 0 ? void 0 : auth.access_token;
87
+ if (!accessToken && ('forwarded_bearer_token' in meta)) {
88
+ accessToken = meta.forwarded_bearer_token;
89
+ }
90
+ if (!accessToken) {
91
+ throw new Error("This user's API token was not found. Either no scopes were asked for, or this is a route.");
92
+ }
93
+ return new EnvoyUserAPI_1.default(accessToken);
94
+ },
95
+ enumerable: false,
96
+ configurable: true
97
+ });
98
+ Object.defineProperty(EnvoyPluginSDK.prototype, "pluginAPI", {
99
+ /**
100
+ * Envoy API scoped to the plugin.
101
+ * Used to perform storage or job operations.
102
+ */
103
+ get: function () {
104
+ var pluginAccessToken = this.pluginAccessToken;
105
+ if (!pluginAccessToken) {
106
+ throw new Error('No API token found. Are your Envoy client ID and secret set?');
107
+ }
108
+ return new EnvoyPluginAPI_1.default(pluginAccessToken);
109
+ },
110
+ enumerable: false,
111
+ configurable: true
112
+ });
113
+ Object.defineProperty(EnvoyPluginSDK.prototype, "getStorage", {
114
+ /**
115
+ * A function that returns an instance of EnvoyPluginStorage,
116
+ * optionally scoped to an install ID.
117
+ *
118
+ * Use {@link installStorage} or {@link globalStorage} instead of this directly.
119
+ */
120
+ get: function () {
121
+ var _this = this;
122
+ return function (installId) { return new EnvoyPluginStorage_1.default(_this.pluginAPI, installId); };
123
+ },
124
+ enumerable: false,
125
+ configurable: true
126
+ });
127
+ Object.defineProperty(EnvoyPluginSDK.prototype, "installStorage", {
128
+ /**
129
+ * Storage scoped to the install.
130
+ */
131
+ get: function () {
132
+ var installId = this.meta.install_id;
133
+ if (!installId) {
134
+ throw new Error('No install ID found in meta.');
135
+ }
136
+ return this.getStorage(installId);
137
+ },
138
+ enumerable: false,
139
+ configurable: true
140
+ });
141
+ Object.defineProperty(EnvoyPluginSDK.prototype, "globalStorage", {
142
+ /**
143
+ * Storage scoped globally (across installs).
144
+ */
145
+ get: function () {
146
+ return this.getStorage();
147
+ },
148
+ enumerable: false,
149
+ configurable: true
150
+ });
151
+ Object.defineProperty(EnvoyPluginSDK.prototype, "getJob", {
152
+ /**
153
+ * Returns a job based on an ID.
154
+ */
155
+ get: function () {
156
+ var _this = this;
157
+ return function (jobId) { return new EnvoyPluginJob_1.default(_this.pluginAPI, jobId); };
158
+ },
159
+ enumerable: false,
160
+ configurable: true
161
+ });
162
+ Object.defineProperty(EnvoyPluginSDK.prototype, "jobId", {
163
+ /**
164
+ * Returns the current job's ID.
165
+ */
166
+ get: function () {
167
+ var meta = this.meta;
168
+ if ('job' in meta) {
169
+ return meta.job.id;
170
+ }
171
+ return null;
172
+ },
173
+ enumerable: false,
174
+ configurable: true
175
+ });
176
+ Object.defineProperty(EnvoyPluginSDK.prototype, "job", {
177
+ /**
178
+ * Perform operations on the current job.
179
+ */
180
+ get: function () {
181
+ var jobId = this.jobId;
182
+ if (!jobId) {
183
+ throw new Error('No job found in meta. Are you in a worker?');
184
+ }
185
+ return this.getJob(jobId);
186
+ },
187
+ enumerable: false,
188
+ configurable: true
189
+ });
190
+ Object.defineProperty(EnvoyPluginSDK.prototype, "jwt", {
191
+ /**
192
+ * A utility to encode and decode JWTs.
193
+ * Useful for verifiable communications between plugin endpoints.
194
+ */
195
+ // eslint-disable-next-line class-methods-use-this
196
+ get: function () {
197
+ return new EnvoyJWT_1.default();
198
+ },
199
+ enumerable: false,
200
+ configurable: true
201
+ });
202
+ return EnvoyPluginSDK;
203
+ }());
204
+ exports.default = EnvoyPluginSDK;
@@ -0,0 +1,69 @@
1
+ import EnvoyPluginStoragePipeline from '../base/EnvoyPluginStoragePipeline';
2
+ import { EnvoyStorageSetUniqueNumOptions, EnvoyStorageSetUniqueOptions } from '../internal/EnvoyStorageCommand';
3
+ import EnvoyStorageItem from './EnvoyStorageItem';
4
+ import EnvoyPluginAPI from './EnvoyPluginAPI';
5
+ /**
6
+ * A key-value storage that can be scoped to a specific install,
7
+ * or to the plugin itself.
8
+ *
9
+ * @category Storage
10
+ * @category Request Object
11
+ */
12
+ export default class EnvoyPluginStorage {
13
+ protected readonly api: EnvoyPluginAPI;
14
+ readonly installId: string | undefined;
15
+ constructor(pluginAPI: EnvoyPluginAPI, installId?: string);
16
+ /**
17
+ * Creates a new pipeline instance.
18
+ */
19
+ pipeline(): EnvoyPluginStoragePipeline;
20
+ /**
21
+ * Gets a single {@link EnvoyStorageItem} from storage.
22
+ *
23
+ * Wrapper for single pipeline get.
24
+ */
25
+ get<Value = unknown>(key: string): Promise<EnvoyStorageItem<Value> | {
26
+ key: string;
27
+ value: undefined;
28
+ }>;
29
+ /**
30
+ * Sets a single {@link EnvoyStorageItem} from storage.
31
+ *
32
+ * Wrapper for single pipeline set.
33
+ */
34
+ set<Value = unknown>(key: string, value: Value): Promise<EnvoyStorageItem<Value>>;
35
+ /**
36
+ * Sets a single unique string {@link EnvoyStorageItem} from storage.
37
+ *
38
+ * Wrapper for single pipeline setUnique.
39
+ */
40
+ setUnique(key: string, options?: EnvoyStorageSetUniqueOptions): Promise<EnvoyStorageItem<string> | {
41
+ key: string;
42
+ value: undefined;
43
+ }>;
44
+ /**
45
+ * Sets a single unique number {@link EnvoyStorageItem} from storage.
46
+ *
47
+ * Wrapper for single pipeline setUnique.
48
+ */
49
+ setUniqueNum(key: string, options?: EnvoyStorageSetUniqueNumOptions): Promise<EnvoyStorageItem<number> | {
50
+ key: string;
51
+ value: undefined;
52
+ }>;
53
+ /**
54
+ * Unsets an {@link EnvoyStorageItem} from storage. Returns null if the item did not previously exist.
55
+ *
56
+ * Wrapper for single pipeline unset.
57
+ */
58
+ unset<Value = unknown>(key: string): Promise<EnvoyStorageItem<Value> | {
59
+ key: string;
60
+ value: undefined;
61
+ }>;
62
+ /**
63
+ * Returns an array of {@link EnvoyStorageItem} from storage.
64
+ *
65
+ * Wrapper for single pipeline list.
66
+ */
67
+ list<Value = unknown>(page?: number): Promise<EnvoyStorageItem<Value>[]>;
68
+ }
69
+ //# sourceMappingURL=EnvoyPluginStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnvoyPluginStorage.d.ts","sourceRoot":"","sources":["../../src/sdk/EnvoyPluginStorage.ts"],"names":[],"mappings":"AAAA,OAAO,0BAA0B,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,+BAA+B,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAChH,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAkB;IACrC,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC;IAEvC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;gBAE3B,SAAS,EAAE,cAAc,EAAE,SAAS,CAAC,EAAE,MAAM;IAKzD;;OAEG;IACH,QAAQ,IAAI,0BAA0B;IAItC;;;;OAIG;IACH,GAAG,CAAC,KAAK,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM;aACiD,MAAM;eAAW,SAAS;;IAG3G;;;;OAIG;IACH,GAAG,CAAC,KAAK,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;IAI9C;;;;OAIG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,4BAAiC;aACgC,MAAM;eAAW,SAAS;;IAG3H;;;;OAIG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,+BAAoC;aAC6B,MAAM;eAAW,SAAS;;IAG9H;;;;OAIG;IACH,KAAK,CAAC,KAAK,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM;aACiD,MAAM;eAAW,SAAS;;IAG7G;;;;OAIG;IACH,IAAI,CAAC,KAAK,GAAG,OAAO,EAAE,IAAI,SAAI;CAG/B"}
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ var EnvoyPluginStoragePipeline_1 = __importDefault(require("../base/EnvoyPluginStoragePipeline"));
7
+ /**
8
+ * A key-value storage that can be scoped to a specific install,
9
+ * or to the plugin itself.
10
+ *
11
+ * @category Storage
12
+ * @category Request Object
13
+ */
14
+ var EnvoyPluginStorage = /** @class */ (function () {
15
+ function EnvoyPluginStorage(pluginAPI, installId) {
16
+ this.api = pluginAPI;
17
+ this.installId = installId;
18
+ }
19
+ /**
20
+ * Creates a new pipeline instance.
21
+ */
22
+ EnvoyPluginStorage.prototype.pipeline = function () {
23
+ return new EnvoyPluginStoragePipeline_1.default(this.api, this.installId);
24
+ };
25
+ /**
26
+ * Gets a single {@link EnvoyStorageItem} from storage.
27
+ *
28
+ * Wrapper for single pipeline get.
29
+ */
30
+ EnvoyPluginStorage.prototype.get = function (key) {
31
+ return this.pipeline().get(key).executeSingle();
32
+ };
33
+ /**
34
+ * Sets a single {@link EnvoyStorageItem} from storage.
35
+ *
36
+ * Wrapper for single pipeline set.
37
+ */
38
+ EnvoyPluginStorage.prototype.set = function (key, value) {
39
+ return this.pipeline().set(key, value).executeSingle();
40
+ };
41
+ /**
42
+ * Sets a single unique string {@link EnvoyStorageItem} from storage.
43
+ *
44
+ * Wrapper for single pipeline setUnique.
45
+ */
46
+ EnvoyPluginStorage.prototype.setUnique = function (key, options) {
47
+ if (options === void 0) { options = {}; }
48
+ return this.pipeline().setUnique(key, options).executeSingle();
49
+ };
50
+ /**
51
+ * Sets a single unique number {@link EnvoyStorageItem} from storage.
52
+ *
53
+ * Wrapper for single pipeline setUnique.
54
+ */
55
+ EnvoyPluginStorage.prototype.setUniqueNum = function (key, options) {
56
+ if (options === void 0) { options = {}; }
57
+ return this.pipeline().setUniqueNum(key, options).executeSingle();
58
+ };
59
+ /**
60
+ * Unsets an {@link EnvoyStorageItem} from storage. Returns null if the item did not previously exist.
61
+ *
62
+ * Wrapper for single pipeline unset.
63
+ */
64
+ EnvoyPluginStorage.prototype.unset = function (key) {
65
+ return this.pipeline().unset(key).executeSingle();
66
+ };
67
+ /**
68
+ * Returns an array of {@link EnvoyStorageItem} from storage.
69
+ *
70
+ * Wrapper for single pipeline list.
71
+ */
72
+ EnvoyPluginStorage.prototype.list = function (page) {
73
+ if (page === void 0) { page = 1; }
74
+ return this.pipeline().list(page).executeSingle();
75
+ };
76
+ return EnvoyPluginStorage;
77
+ }());
78
+ exports.default = EnvoyPluginStorage;