@foxtware/mineral 0.1.0

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 (73) hide show
  1. package/.creds.yml.sample +21 -0
  2. package/AGENTS.md +13 -0
  3. package/README.md +52 -0
  4. package/_build_scripts/copyCredsToEnv.js +45 -0
  5. package/_build_scripts/createNewFunction.js +361 -0
  6. package/_docs/standard_response_examples.md +67 -0
  7. package/api/_example.js +45 -0
  8. package/api/constants.js +3 -0
  9. package/api/linear/linear.constants.js +5 -0
  10. package/api/linear/linear.utils.js +43 -0
  11. package/api/linear/linearIssuesGet.js +106 -0
  12. package/api/peoplevox/.gitkeep +0 -0
  13. package/api/peoplevox/_example.js +49 -0
  14. package/api/peoplevox/peoplevox.constants.js +3 -0
  15. package/api/peoplevox/peoplevox.utils.js +191 -0
  16. package/api/peoplevox/peoplevoxAuthGet.js +99 -0
  17. package/api/peoplevox/peoplevoxGetSingle.js +119 -0
  18. package/api/peoplevox/peoplevoxOrderEdit.js +82 -0
  19. package/api/peoplevox/peoplevoxOrderGet.js +60 -0
  20. package/api/peoplevox/peoplevoxReportGet.js +76 -0
  21. package/api/shopify/.gitkeep +0 -0
  22. package/api/shopify/_example.create.js +69 -0
  23. package/api/shopify/_example.getsingle.js +55 -0
  24. package/api/shopify/_example.js +45 -0
  25. package/api/shopify/_example.mutation.js +58 -0
  26. package/api/shopify/shopify.constants.js +7 -0
  27. package/api/shopify/shopify.utils.js +123 -0
  28. package/api/shopify/shopifyCollectionGet.js +109 -0
  29. package/api/shopify/shopifyCustomerCreate.js +71 -0
  30. package/api/shopify/shopifyCustomerGet.js +112 -0
  31. package/api/shopify/shopifyCustomerMarketingConsentUpdateEmail.js +84 -0
  32. package/api/shopify/shopifyCustomerUpdate.js +75 -0
  33. package/api/shopify/shopifyCustomersGet.js +50 -0
  34. package/api/shopify/shopifyGet.js +309 -0
  35. package/api/shopify/shopifyGetSingle.js +106 -0
  36. package/api/shopify/shopifyGiftCardCreate.js +95 -0
  37. package/api/shopify/shopifyGiftCardDeactivate.js +58 -0
  38. package/api/shopify/shopifyMetafieldsSet.js +100 -0
  39. package/api/shopify/shopifyMutationDo.js +95 -0
  40. package/api/shopify/shopifyOrderGet.js +123 -0
  41. package/api/shopify/shopifyOrdersGet.js +80 -0
  42. package/api/shopify/shopifyPageDelete.js +59 -0
  43. package/api/shopify/shopifyPageGet.js +57 -0
  44. package/api/shopify/shopifyPageUpdate.js +79 -0
  45. package/api/shopify/shopifyTagsAdd.js +94 -0
  46. package/api/shopify/shopifyTagsRemove.js +94 -0
  47. package/api/shopify/shopifyThemeDelete.js +87 -0
  48. package/api/shopify/shopifyThemeDuplicate.js +70 -0
  49. package/api/shopify/shopifyThemeGet.js +59 -0
  50. package/api/shopify/shopifyThemeUpdate.js +71 -0
  51. package/api/shopify/shopifyThemesGet.js +63 -0
  52. package/api/utils.js +1166 -0
  53. package/api/validators.js +12 -0
  54. package/api/yotpo/yotpo.constants.js +7 -0
  55. package/api/yotpo/yotpo.utils.js +47 -0
  56. package/api/yotpo/yotpoCampaignsGet.js +75 -0
  57. package/api/yotpo/yotpoCustomerActionRecord.js +95 -0
  58. package/api/yotpo/yotpoCustomerAnniversaryGet.js +60 -0
  59. package/api/yotpo/yotpoCustomerAnniversarySet.js +78 -0
  60. package/api/yotpo/yotpoCustomerBirthdaySet.js +91 -0
  61. package/api/yotpo/yotpoCustomerGet.js +104 -0
  62. package/api/yotpo/yotpoCustomerPointsAdjust.js +89 -0
  63. package/api/yotpo/yotpoCustomerUpsert.js +91 -0
  64. package/api/yotpo/yotpoCustomersRecentGet.js +62 -0
  65. package/api/yotpo/yotpoRedemptionCreate.js +96 -0
  66. package/api/yotpo/yotpoRedemptionOptionsGet.js +78 -0
  67. package/api/yotpo/yotpoVipTiersGet.js +51 -0
  68. package/api/youtube/youtubeChannelVideosGet.js +249 -0
  69. package/bin/mineral.js +5 -0
  70. package/package.json +24 -0
  71. package/server.js +196 -0
  72. package/server.utils.js +228 -0
  73. package/test.js +19 -0
@@ -0,0 +1,91 @@
1
+ // https://loyaltyapi.yotpo.com/reference/createupdate-customer-records
2
+
3
+ const { credsFromPayload, ArgsWarden } = require('../utils');
4
+ const { credsValidator } = require('../validators');
5
+ const { yotpoClient } = require('../yotpo/yotpo.utils');
6
+
7
+ const argsWarden = new ArgsWarden([
8
+ ['credsPayload', credsValidator],
9
+ ['email'],
10
+ ]);
11
+
12
+ const yotpoCustomerUpsert = async (
13
+ credsPayload,
14
+ email,
15
+ {
16
+ apiVersion,
17
+
18
+ id,
19
+ firstName,
20
+ lastName,
21
+ phoneNumber,
22
+ countryIsoCode,
23
+ hasAccount,
24
+ platformAccountCreatedAt,
25
+ optedIn,
26
+ posAccountId,
27
+ tags,
28
+ optedInAt,
29
+ } = {},
30
+ ) => {
31
+
32
+ const rejectResponse = await argsWarden.responseIfRejectingArgs({
33
+ credsPayload,
34
+ email,
35
+ });
36
+ if (rejectResponse) {
37
+ return rejectResponse;
38
+ }
39
+
40
+ const creds = await credsFromPayload(credsPayload);
41
+
42
+ const body = {
43
+ email,
44
+ ...(id && { id }),
45
+ ...(firstName && { first_name: firstName }),
46
+ ...(lastName && { last_name: lastName }),
47
+ ...(phoneNumber && { phone_number: phoneNumber }),
48
+ ...(countryIsoCode && { country_iso_code: countryIsoCode }),
49
+ ...(hasAccount !== undefined && { has_account: hasAccount }),
50
+ ...(platformAccountCreatedAt && { platform_account_created_at: platformAccountCreatedAt }),
51
+ ...(optedIn !== undefined && { opted_in: optedIn }),
52
+ ...(posAccountId && { pos_account_id: posAccountId }),
53
+ ...(tags && { tags }),
54
+ ...(optedInAt && { opted_in_at: optedInAt }),
55
+ };
56
+
57
+ const response = await yotpoClient.fetch({
58
+ url: '/customers',
59
+ method: 'post',
60
+ body,
61
+ context: {
62
+ creds,
63
+ apiVersion,
64
+ },
65
+ });
66
+
67
+ return response;
68
+ };
69
+
70
+ const funcApiConfig = {
71
+ argsWarden,
72
+ };
73
+
74
+ module.exports = {
75
+ yotpoCustomerUpsert,
76
+ funcApiConfig,
77
+ };
78
+
79
+ /*
80
+ curl -X POST "http://localhost:8000/yotpoCustomerUpsert" \
81
+ -H "Content-Type: application/json" \
82
+ -d '{
83
+ "credsPayload": { "credsPath": "yotpo.johto" },
84
+ "email": "ash@pokemail.com",
85
+ "options": {
86
+ "id": "1",
87
+ "firstName": "Ash",
88
+ "lastName": "Ketchum"
89
+ }
90
+ }'
91
+ */
@@ -0,0 +1,62 @@
1
+ // https://loyaltyapi.yotpo.com/reference/fetch-all-recently-updated-customers
2
+
3
+ const { credsFromPayload, ArgsWarden } = require('../utils');
4
+ const { credsValidator } = require('../validators');
5
+ const { yotpoClient } = require('../yotpo/yotpo.utils');
6
+
7
+ const argsWarden = new ArgsWarden([
8
+ ['credsPayload', credsValidator],
9
+ ]);
10
+
11
+ const yotpoCustomersRecentGet = async (
12
+ credsPayload,
13
+ {
14
+ apiVersion,
15
+ pageInfo,
16
+ perPage,
17
+ } = {},
18
+ ) => {
19
+
20
+ const rejectResponse = await argsWarden.responseIfRejectingArgs({ credsPayload });
21
+ if (rejectResponse) {
22
+ return rejectResponse;
23
+ }
24
+
25
+ const creds = await credsFromPayload(credsPayload);
26
+
27
+ const params = {
28
+ ...(pageInfo && { page_info: pageInfo }),
29
+ ...(perPage !== undefined && { per_page: perPage }),
30
+ };
31
+
32
+ const response = await yotpoClient.fetch({
33
+ url: '/customers/recent',
34
+ params,
35
+ context: {
36
+ creds,
37
+ apiVersion,
38
+ },
39
+ });
40
+
41
+ return response;
42
+ };
43
+
44
+ const funcApiConfig = {
45
+ argsWarden,
46
+ };
47
+
48
+ module.exports = {
49
+ yotpoCustomersRecentGet,
50
+ funcApiConfig,
51
+ };
52
+
53
+ /*
54
+ curl -X POST "http://localhost:8000/yotpoCustomersRecentGet" \
55
+ -H "Content-Type: application/json" \
56
+ -d '{
57
+ "credsPayload": { "credsPath": "yotpo.au" },
58
+ "options": {
59
+ "perPage": 10
60
+ }
61
+ }'
62
+ */
@@ -0,0 +1,96 @@
1
+ // https://loyaltyapi.yotpo.com/reference/create-redemption
2
+
3
+ const { credsFromPayload, objHasAny, ArgsWarden } = require('../utils');
4
+ const { credsValidator } = require('../validators');
5
+ const { yotpoClient } = require('../yotpo/yotpo.utils');
6
+
7
+ const customerIdentifierValidator = (customerIdentifier) => {
8
+ return objHasAny(customerIdentifier, [
9
+ 'customerId',
10
+ 'customerEmail',
11
+ 'phoneNumber',
12
+ 'posAccountId',
13
+ ]);
14
+ };
15
+
16
+ const redemptionOptionIdValidator = Number;
17
+
18
+ const argsWarden = new ArgsWarden([
19
+ ['credsPayload', credsValidator],
20
+ ['customerIdentifier', customerIdentifierValidator],
21
+ ['redemptionOptionId', redemptionOptionIdValidator],
22
+ ]);
23
+
24
+ const yotpoRedemptionCreate = async (
25
+ credsPayload,
26
+ customerIdentifier,
27
+ // redemptionOptionId must come from yotpoRedemptionOptionsGet
28
+ redemptionOptionId,
29
+ {
30
+ apiVersion,
31
+ delayPointsDeduction,
32
+ currency,
33
+ pointsToRedeem,
34
+ } = {},
35
+ ) => {
36
+
37
+ const rejectResponse = await argsWarden.responseIfRejectingArgs({
38
+ credsPayload,
39
+ customerIdentifier,
40
+ redemptionOptionId,
41
+ });
42
+ if (rejectResponse) {
43
+ return rejectResponse;
44
+ }
45
+
46
+ const creds = await credsFromPayload(credsPayload);
47
+
48
+ const {
49
+ customerId,
50
+ customerEmail,
51
+ phoneNumber,
52
+ posAccountId,
53
+ } = customerIdentifier;
54
+
55
+ const body = {
56
+ redemption_option_id: Number(redemptionOptionId),
57
+ ...(customerId && { customer_id: customerId }),
58
+ ...(customerEmail && { customer_email: customerEmail }),
59
+ ...(phoneNumber && { phone_number: phoneNumber }),
60
+ ...(posAccountId && { pos_account_id: posAccountId }),
61
+ ...(delayPointsDeduction !== undefined && { delay_points_deduction: delayPointsDeduction }),
62
+ ...(currency && { currency }),
63
+ ...(pointsToRedeem !== undefined && { points_to_redeem: Number(pointsToRedeem) }),
64
+ };
65
+
66
+ const response = await yotpoClient.fetch({
67
+ url: '/redemptions',
68
+ method: 'post',
69
+ body,
70
+ context: {
71
+ creds,
72
+ apiVersion,
73
+ },
74
+ });
75
+
76
+ return response;
77
+ };
78
+
79
+ const funcApiConfig = {
80
+ argsWarden,
81
+ };
82
+
83
+ module.exports = {
84
+ yotpoRedemptionCreate,
85
+ funcApiConfig,
86
+ };
87
+
88
+ /*
89
+ curl -X POST "http://localhost:8000/yotpoRedemptionCreate" \
90
+ -H "Content-Type: application/json" \
91
+ -d '{
92
+ "credsPayload": { "credsPath": "yotpo.au" },
93
+ "customerIdentifier": { "customerEmail": "john@whitefoxboutique.com" },
94
+ "redemptionOptionId": 111111
95
+ }'
96
+ */
@@ -0,0 +1,78 @@
1
+ // https://loyaltyapi.yotpo.com/reference/fetch-active-redemption-options
2
+
3
+ const { credsFromPayload, ArgsWarden } = require('../utils');
4
+ const { credsValidator } = require('../validators');
5
+ const { yotpoClient } = require('../yotpo/yotpo.utils');
6
+
7
+ const argsWarden = new ArgsWarden([
8
+ ['credsPayload', credsValidator],
9
+ ]);
10
+
11
+ const yotpoRedemptionOptionsGet = async (
12
+ credsPayload,
13
+ {
14
+ apiVersion,
15
+ isOffline,
16
+ discountType,
17
+ customerIdentifier,
18
+ } = {},
19
+ ) => {
20
+
21
+ const rejectResponse = await argsWarden.responseIfRejectingArgs({ credsPayload });
22
+ if (rejectResponse) {
23
+ return rejectResponse;
24
+ }
25
+
26
+ const creds = await credsFromPayload(credsPayload);
27
+
28
+ const {
29
+ customerId,
30
+ customerEmail,
31
+ phoneNumber,
32
+ } = customerIdentifier ?? {};
33
+
34
+ const params = {
35
+ ...(isOffline !== undefined && { is_offline: isOffline }),
36
+ ...(discountType && { discount_type: discountType }),
37
+ ...(customerId && { customer_id: customerId }),
38
+ ...(customerEmail && { customer_email: customerEmail }),
39
+ ...(phoneNumber && { phone_number: phoneNumber }),
40
+ };
41
+
42
+ const response = await yotpoClient.fetch({
43
+ url: '/redemption_options',
44
+ params,
45
+ context: {
46
+ creds,
47
+ apiVersion,
48
+ },
49
+ });
50
+
51
+ return response;
52
+ };
53
+
54
+ const funcApiConfig = {
55
+ argsWarden,
56
+ };
57
+
58
+ module.exports = {
59
+ yotpoRedemptionOptionsGet,
60
+ funcApiConfig,
61
+ };
62
+
63
+ /*
64
+ curl -X POST "http://localhost:8000/yotpoRedemptionOptionsGet" \
65
+ -H "Content-Type: application/json" \
66
+ -d '{
67
+ "credsPayload": { "credsPath": "yotpo.au" }
68
+ }'
69
+
70
+ curl -X POST "http://localhost:8000/yotpoRedemptionOptionsGet" \
71
+ -H "Content-Type: application/json" \
72
+ -d '{
73
+ "credsPayload": { "credsPath": "yotpo.au" },
74
+ "options": {
75
+ "customerIdentifier": { "customerEmail": "john@whitefoxboutique.com" }
76
+ }
77
+ }'
78
+ */
@@ -0,0 +1,51 @@
1
+ // https://loyaltyapi.yotpo.com/reference/fetch-vip-tiers
2
+
3
+ const { credsFromPayload, ArgsWarden } = require('../utils');
4
+ const { credsValidator } = require('../validators');
5
+ const { yotpoClient } = require('../yotpo/yotpo.utils');
6
+
7
+ const argsWarden = new ArgsWarden([
8
+ ['credsPayload', credsValidator],
9
+ ]);
10
+
11
+ const yotpoVipTiersGet = async (
12
+ credsPayload,
13
+ {
14
+ apiVersion,
15
+ } = {},
16
+ ) => {
17
+
18
+ const rejectResponse = await argsWarden.responseIfRejectingArgs({ credsPayload });
19
+ if (rejectResponse) {
20
+ return rejectResponse;
21
+ }
22
+
23
+ const creds = await credsFromPayload(credsPayload);
24
+
25
+ const response = await yotpoClient.fetch({
26
+ url: '/vip_tiers',
27
+ context: {
28
+ creds,
29
+ apiVersion,
30
+ },
31
+ });
32
+
33
+ return response;
34
+ };
35
+
36
+ const funcApiConfig = {
37
+ argsWarden,
38
+ };
39
+
40
+ module.exports = {
41
+ yotpoVipTiersGet,
42
+ funcApiConfig,
43
+ };
44
+
45
+ /*
46
+ curl -X POST "http://localhost:8000/yotpoVipTiersGet" \
47
+ -H "Content-Type: application/json" \
48
+ -d '{
49
+ "credsPayload": { "credsPath": "yotpo.au" }
50
+ }'
51
+ */
@@ -0,0 +1,249 @@
1
+ // https://developers.google.com/youtube/v3/guides/implementation/videos
2
+
3
+ const { FetchClient, credsFromPayload, ArgsWarden } = require('../utils');
4
+ const { credsValidator } = require('../validators');
5
+
6
+ const YOUTUBE_API_BASE = 'https://www.googleapis.com/youtube/v3';
7
+
8
+ const parseChannelHandle = (channelHandle) => {
9
+ const trimmed = channelHandle.trim();
10
+
11
+ if (trimmed.startsWith('@')) {
12
+ return trimmed.slice(1);
13
+ }
14
+
15
+ return trimmed;
16
+ };
17
+
18
+ const youtubeClient = new FetchClient({
19
+ requestPreparer: async (requestPayload, context) => {
20
+ const { creds } = context;
21
+ const { API_KEY } = creds;
22
+
23
+ return {
24
+ ...requestPayload,
25
+ params: {
26
+ key: API_KEY,
27
+ ...requestPayload.params,
28
+ },
29
+ };
30
+ },
31
+ responseInterpreter: async (response) => {
32
+ if (!response.ok) {
33
+ const youtubeError = response.error?.details?.error;
34
+
35
+ if (youtubeError) {
36
+ return {
37
+ ok: false,
38
+ error: {
39
+ code: youtubeError.code,
40
+ message: youtubeError.message,
41
+ details: youtubeError,
42
+ },
43
+ };
44
+ }
45
+
46
+ return response;
47
+ }
48
+
49
+ const { data } = response;
50
+
51
+ if (data?.error) {
52
+ return {
53
+ ok: false,
54
+ error: {
55
+ code: data.error.code,
56
+ message: data.error.message,
57
+ details: data.error,
58
+ },
59
+ };
60
+ }
61
+
62
+ return response;
63
+ },
64
+ });
65
+
66
+ const formatVideo = (video) => {
67
+ const {
68
+ id,
69
+ snippet = {},
70
+ statistics = {},
71
+ contentDetails = {},
72
+ } = video;
73
+
74
+ return {
75
+ id,
76
+ title: snippet.title,
77
+ description: snippet.description,
78
+ publishedAt: snippet.publishedAt,
79
+ thumbnails: snippet.thumbnails,
80
+ viewCount: statistics.viewCount,
81
+ likeCount: statistics.likeCount,
82
+ commentCount: statistics.commentCount,
83
+ duration: contentDetails.duration,
84
+ };
85
+ };
86
+
87
+ const argsWarden = new ArgsWarden([
88
+ ['credsPayload', credsValidator],
89
+ ['channelHandle'],
90
+ ]);
91
+
92
+ const youtubeChannelVideosGet = async (
93
+ credsPayload,
94
+ channelHandle,
95
+ {
96
+ maxVideos,
97
+ inspect = false,
98
+ } = {},
99
+ ) => {
100
+
101
+ const rejectResponse = await argsWarden.responseIfRejectingArgs({
102
+ credsPayload,
103
+ channelHandle,
104
+ });
105
+ if (rejectResponse) {
106
+ return rejectResponse;
107
+ }
108
+
109
+ const creds = await credsFromPayload(credsPayload);
110
+ const fetchContext = { creds };
111
+ const handle = parseChannelHandle(channelHandle);
112
+
113
+ const channelResponse = await youtubeClient.fetch({
114
+ url: `${ YOUTUBE_API_BASE }/channels`,
115
+ params: {
116
+ part: 'contentDetails',
117
+ forHandle: handle,
118
+ },
119
+ context: fetchContext,
120
+ inspect,
121
+ });
122
+
123
+ if (!channelResponse.ok) {
124
+ return channelResponse;
125
+ }
126
+
127
+ const channel = channelResponse.data?.items?.[0];
128
+ const channelId = channel?.id;
129
+ const uploadsPlaylistId = channel?.contentDetails?.relatedPlaylists?.uploads;
130
+
131
+ if (!channelId) {
132
+ return {
133
+ ok: false,
134
+ error: {
135
+ code: 'CHANNEL_NOT_FOUND',
136
+ message: `No channel found for handle @${ handle }`,
137
+ },
138
+ };
139
+ }
140
+
141
+ if (!uploadsPlaylistId) {
142
+ return {
143
+ ok: false,
144
+ error: {
145
+ code: 'UPLOADS_PLAYLIST_NOT_FOUND',
146
+ message: `No uploads playlist found for channel ${ channelId }`,
147
+ },
148
+ };
149
+ }
150
+
151
+ const videoIds = [];
152
+ let nextPageToken;
153
+
154
+ while (true) {
155
+ const playlistResponse = await youtubeClient.fetch({
156
+ url: `${ YOUTUBE_API_BASE }/playlistItems`,
157
+ params: {
158
+ part: 'contentDetails',
159
+ playlistId: uploadsPlaylistId,
160
+ maxResults: 50,
161
+ ...(nextPageToken ? { pageToken: nextPageToken } : {}),
162
+ },
163
+ context: fetchContext,
164
+ inspect,
165
+ });
166
+
167
+ if (!playlistResponse.ok) {
168
+ return playlistResponse;
169
+ }
170
+
171
+ const pageVideoIds = (playlistResponse.data?.items ?? [])
172
+ .map((item) => item.contentDetails?.videoId)
173
+ .filter(Boolean);
174
+
175
+ videoIds.push(...pageVideoIds);
176
+
177
+ if (maxVideos && videoIds.length >= maxVideos) {
178
+ videoIds.splice(maxVideos);
179
+ break;
180
+ }
181
+
182
+ nextPageToken = playlistResponse.data?.nextPageToken;
183
+
184
+ if (!nextPageToken) {
185
+ break;
186
+ }
187
+ }
188
+
189
+ if (!videoIds.length) {
190
+ return {
191
+ ok: true,
192
+ data: {
193
+ channelId,
194
+ videos: [],
195
+ },
196
+ };
197
+ }
198
+
199
+ const videos = [];
200
+
201
+ for (let index = 0; index < videoIds.length; index += 50) {
202
+ const batchIds = videoIds.slice(index, index + 50).join(',');
203
+
204
+ const videosResponse = await youtubeClient.fetch({
205
+ url: `${ YOUTUBE_API_BASE }/videos`,
206
+ params: {
207
+ part: 'snippet,statistics,contentDetails',
208
+ id: batchIds,
209
+ },
210
+ context: fetchContext,
211
+ inspect,
212
+ });
213
+
214
+ if (!videosResponse.ok) {
215
+ return videosResponse;
216
+ }
217
+
218
+ videos.push(
219
+ ...(videosResponse.data?.items ?? []).map(formatVideo),
220
+ );
221
+ }
222
+
223
+ return {
224
+ ok: true,
225
+ data: {
226
+ channelId,
227
+ videos,
228
+ },
229
+ };
230
+ };
231
+
232
+ const funcApiConfig = {
233
+ argsWarden,
234
+ };
235
+
236
+ module.exports = {
237
+ youtubeChannelVideosGet,
238
+ funcApiConfig,
239
+ };
240
+
241
+ /*
242
+ curl -X POST "http://localhost:8000/youtubeChannelVideosGet" \
243
+ -H "Content-Type: application/json" \
244
+ -d '{
245
+ "credsPayload": { "credsPath": "youtube" },
246
+ "channelHandle": "garyseconomics",
247
+ "options": { "maxVideos": 5 }
248
+ }'
249
+ */
package/bin/mineral.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { startServer } = require('../server');
4
+
5
+ startServer();
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@foxtware/mineral",
3
+ "version": "0.1.0",
4
+ "bin": { "mineral": "bin/mineral.js" },
5
+ "main": "server.js",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "scripts": {
10
+ "creds_to_env": "node _build_scripts/copyCredsToEnv.js",
11
+ "dev": "node --watch --watch-path=./api --watch-path=./server.js --watch-path=./server.utils.js --watch-path=./.creds.yml server.js",
12
+ "new": "node _build_scripts/createNewFunction.js",
13
+ "serve": "PORT=8100 node server.js",
14
+ "start": "node server.js",
15
+ "npm:publish": "npm publish"
16
+ },
17
+ "dependencies": {
18
+ "csvtojson": "^2.0.14",
19
+ "dotenv": "^17.2.0",
20
+ "json-2-csv": "^5.5.9",
21
+ "xml2js": "^0.6.2",
22
+ "yaml": "^2.9.0"
23
+ }
24
+ }