@foxtware/mineral 0.1.8 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.creds.yml.sample +43 -1
- package/AGENTS.md +6 -1
- package/README.md +1 -1
- package/api/bleckmann/.gitkeep +0 -0
- package/api/bleckmann/bleckmann.constants.js +8 -0
- package/api/bleckmann/bleckmann.utils.js +32 -0
- package/api/bleckmann/bleckmannAsnGet.js +52 -0
- package/api/bleckmann/bleckmannAsnsGet.js +65 -0
- package/api/constants.js +2 -1
- package/api/github/github.constants.js +11 -0
- package/api/github/github.utils.js +65 -0
- package/api/github/githubGet.js +144 -0
- package/api/github/githubIssueCreate.js +71 -0
- package/api/github/githubIssueGet.js +65 -0
- package/api/github/githubIssueUpdate.js +71 -0
- package/api/github/githubIssuesGet.js +74 -0
- package/api/github/githubPullRequestCreate.js +74 -0
- package/api/github/githubPullRequestGet.js +65 -0
- package/api/github/githubPullRequestMerge.js +77 -0
- package/api/github/githubPullRequestUpdate.js +72 -0
- package/api/github/githubPullRequestsGet.js +74 -0
- package/api/github/githubRepoCreate.js +80 -0
- package/api/github/githubRepoDelete.js +60 -0
- package/api/github/githubRepoGet.js +61 -0
- package/api/github/githubRepoUpdate.js +68 -0
- package/api/github/githubReposGet.js +69 -0
- package/api/github/githubUserGet.js +64 -0
- package/api/linear/linear.utils.js +9 -14
- package/api/linear/linearIssuesGet.js +9 -9
- package/api/logiwa/logiwa.utils.js +27 -25
- package/api/logiwa/logiwaInventoriesGet.js +5 -3
- package/api/logiwa/logiwaOrderGet.js +4 -2
- package/api/logiwa/logiwaOrdersGet.js +5 -3
- package/api/logiwa/logiwaProductGet.js +4 -2
- package/api/logiwa/logiwaProductsGet.js +5 -3
- package/api/logiwa/logiwaReportGetAvailableToPromise.js +5 -3
- package/api/logiwa/logiwaReportGetInventoryCalculation.js +5 -3
- package/api/logiwa/logiwaReportGetInventorySnapshot.js +5 -3
- package/api/logiwa/logiwaReportGetTotalInventory.js +5 -3
- package/api/logiwa/logiwaWebhookStatusGet.js +4 -2
- package/api/logiwa/logiwaWebhookSubscribe.js +8 -6
- package/api/logiwa/logiwaWebhookUnsubscribe.js +4 -2
- package/api/logiwa/logiwaWebhooksGet.js +4 -2
- package/api/loop/loop.constants.js +7 -0
- package/api/loop/loop.utils.js +37 -0
- package/api/loop/loopAllowlistItemsGet.js +42 -0
- package/api/loop/loopBlocklistItemsGet.js +46 -0
- package/api/loop/loopDestinationsGet.js +42 -0
- package/api/loop/loopGet.js +139 -0
- package/api/loop/loopReturnGet.js +73 -0
- package/api/loop/loopReturnsGet.js +46 -0
- package/api/peoplevox/peoplevox.constants.js +1 -1
- package/api/peoplevox/peoplevox.sessions.js +54 -0
- package/api/peoplevox/peoplevox.utils.js +67 -31
- package/api/peoplevox/peoplevoxGetSingle.js +7 -5
- package/api/peoplevox/peoplevoxOrderEdit.js +7 -5
- package/api/peoplevox/peoplevoxReportGet.js +11 -9
- package/api/pipelineSteps.js +49 -0
- package/api/shopify/shopify.utils.js +18 -24
- package/api/shopify/shopifyBulkMutationDo.js +211 -0
- package/api/shopify/shopifyBulkOperationGet.js +86 -0
- package/api/shopify/shopifyBulkOperationRunMutation.js +83 -0
- package/api/shopify/shopifyCheckoutAndAccountsConfigurationUpdate.js +79 -0
- package/api/shopify/shopifyCollectionGet.js +7 -7
- package/api/shopify/shopifyCustomerGet.js +6 -6
- package/api/shopify/shopifyGet.js +18 -13
- package/api/shopify/shopifyGetSingle.js +9 -9
- package/api/shopify/shopifyMutationDo.js +6 -6
- package/api/shopify/shopifyOrdersGet.js +11 -11
- package/api/shopify/shopifyStagedUploadCreate.js +96 -0
- package/api/shopify/shopifyTagsAdd.js +1 -1
- package/api/shopify/shopifyTagsAddBulk.js +90 -0
- package/api/shopify/shopifyTagsRemove.js +1 -1
- package/api/slack/slack.utils.js +10 -19
- package/api/slack/slackMessagePost.js +11 -11
- package/api/starshipit/starshipit.constants.js +8 -0
- package/api/starshipit/starshipit.utils.js +71 -0
- package/api/starshipit/starshipitAddressCreate.js +77 -0
- package/api/starshipit/starshipitAddressDelete.js +55 -0
- package/api/starshipit/starshipitAddressUpdate.js +69 -0
- package/api/starshipit/starshipitAddressesGet.js +52 -0
- package/api/starshipit/starshipitGet.js +146 -0
- package/api/starshipit/starshipitOrderDelete.js +102 -0
- package/api/starshipit/starshipitOrderGet.js +74 -0
- package/api/starshipit/starshipitOrderUpdate.js +109 -0
- package/api/starshipit/starshipitOrdersListShipped.js +64 -0
- package/api/starshipit/starshipitProductAdd.js +100 -0
- package/api/starshipit/starshipitProductsDelete.js +57 -0
- package/api/starshipit/starshipitProductsGet.js +49 -0
- package/api/starshipit/starshipitTrackingGet.js +69 -0
- package/api/stripe/_example.js +48 -0
- package/api/stripe/stripe.constants.js +5 -0
- package/api/stripe/stripe.utils.js +42 -0
- package/api/stripe/stripeCardCharge.js +98 -0
- package/api/stripe/stripeCardTokenCreate.js +70 -0
- package/api/stripe/stripeChargeCapture.js +63 -0
- package/api/stripe/stripeChargeCreate.js +70 -0
- package/api/stripe/stripeChargeGet.js +51 -0
- package/api/stripe/stripeChargesGet.js +52 -0
- package/api/stripe/stripeRefundCreate.js +64 -0
- package/api/stripe/stripeRefundGet.js +51 -0
- package/api/stripe/stripeRefundsGet.js +52 -0
- package/api/stripe/stripeTokenGet.js +51 -0
- package/api/stylearcade/stylearcade.constants.js +5 -0
- package/api/stylearcade/stylearcade.utils.js +40 -0
- package/api/stylearcade/stylearcadeDataGet.js +62 -0
- package/api/stylearcade/stylearcadeGet.js +133 -0
- package/api/stylearcade/stylearcadeMetadataGet.js +47 -0
- package/api/supabase/supabase.utils.js +52 -0
- package/api/supabase/supabaseRowDelete.js +95 -0
- package/api/supabase/supabaseRowGet.js +58 -0
- package/api/supabase/supabaseRowInsert.js +56 -0
- package/api/supabase/supabaseRowUpdate.js +58 -0
- package/api/supabase/supabaseRpc.js +61 -0
- package/api/supabase/supabaseTableGet.js +44 -0
- package/api/supabase/supabaseTableGetAll.js +86 -0
- package/api/threeclicks/threeclicks.constants.js +8 -0
- package/api/threeclicks/threeclicks.utils.js +119 -0
- package/api/threeclicks/threeclicksCollectionsGet.js +40 -0
- package/api/threeclicks/threeclicksGet.js +138 -0
- package/api/threeclicks/threeclicksKeycodeCreate.js +55 -0
- package/api/threeclicks/threeclicksKeycodeGet.js +47 -0
- package/api/threeclicks/threeclicksPurchaseOrderCreate.js +34 -0
- package/api/threeclicks/threeclicksPurchaseOrderCreateBulk.js +34 -0
- package/api/threeclicks/threeclicksPurchaseOrderGet.js +33 -0
- package/api/threeclicks/threeclicksPurchaseOrderQuantitiesGet.js +33 -0
- package/api/threeclicks/threeclicksPurchaseOrderQuantityCreate.js +34 -0
- package/api/threeclicks/threeclicksPurchaseOrderQuantityCreateBulk.js +34 -0
- package/api/threeclicks/threeclicksPurchaseOrderQuantityUpdate.js +46 -0
- package/api/threeclicks/threeclicksPurchaseOrderQuantityUpdateBulk.js +46 -0
- package/api/threeclicks/threeclicksPurchaseOrderUpdate.js +35 -0
- package/api/threeclicks/threeclicksPurchaseOrdersGet.js +30 -0
- package/api/threeclicks/threeclicksShipmentCreate.js +34 -0
- package/api/threeclicks/threeclicksShipmentGet.js +33 -0
- package/api/threeclicks/threeclicksShipmentOrderAdd.js +38 -0
- package/api/threeclicks/threeclicksShipmentOrderQuantityCreate.js +35 -0
- package/api/threeclicks/threeclicksShipmentQuantityUpdate.js +35 -0
- package/api/threeclicks/threeclicksShipmentStatusUpdate.js +45 -0
- package/api/threeclicks/threeclicksShipmentsGet.js +52 -0
- package/api/threeclicks/threeclicksSignatureCalculate.js +73 -0
- package/api/threeclicks/threeclicksStyleCodesGet.js +46 -0
- package/api/threeclicks/threeclicksStyleColourCreate.js +47 -0
- package/api/threeclicks/threeclicksStyleColourDelete.js +34 -0
- package/api/threeclicks/threeclicksStyleCreate.js +44 -0
- package/api/threeclicks/threeclicksStyleDelete.js +33 -0
- package/api/threeclicks/threeclicksStyleGet.js +43 -0
- package/api/threeclicks/threeclicksStylePriceUpdate.js +70 -0
- package/api/threeclicks/threeclicksStyleUpdate.js +47 -0
- package/api/threeclicks/threeclicksStylesGet.js +45 -0
- package/api/upstash/upstash.utils.js +36 -0
- package/api/upstash/upstashDel.js +46 -0
- package/api/upstash/upstashExists.js +46 -0
- package/api/upstash/upstashGet.js +46 -0
- package/api/upstash/upstashSet.js +64 -0
- package/api/utils.js +90 -76
- package/api/validators.js +1 -1
- package/api/workable/workable.constants.js +3 -0
- package/api/workable/workable.utils.js +41 -0
- package/api/workable/workableGet.js +151 -0
- package/api/workable/workableJobCandidateCreate.js +87 -0
- package/api/workable/workableJobGet.js +52 -0
- package/api/workable/workableJobMembersGet.js +52 -0
- package/api/workable/workableJobStagesGet.js +52 -0
- package/api/workable/workableJobsGet.js +78 -0
- package/api/yotpo/yotpo.utils.js +17 -22
- package/api/yotpo/yotpoCampaignsGet.js +6 -6
- package/api/yotpo/yotpoCustomerActionRecord.js +7 -7
- package/api/yotpo/yotpoCustomerAnniversaryGet.js +7 -7
- package/api/yotpo/yotpoCustomerAnniversarySet.js +7 -7
- package/api/yotpo/yotpoCustomerBirthdaySet.js +7 -7
- package/api/yotpo/yotpoCustomerGet.js +6 -6
- package/api/yotpo/yotpoCustomerPointsAdjust.js +7 -7
- package/api/yotpo/yotpoCustomerUpsert.js +7 -7
- package/api/yotpo/yotpoCustomersRecentGet.js +6 -6
- package/api/yotpo/yotpoRedemptionCreate.js +7 -7
- package/api/yotpo/yotpoRedemptionOptionsGet.js +6 -6
- package/api/yotpo/yotpoVipTiersGet.js +5 -5
- package/api/youtube/youtube.constants.js +5 -0
- package/api/youtube/youtube.utils.js +77 -0
- package/api/youtube/youtubeChannelVideosGet.js +25 -70
- package/hosting/.hosting.yml.sample +9 -11
- package/hosting/copyCredsToEnv.js +58 -2
- package/hosting/deployFromHostingYml.js +9 -2
- package/hosting/hosting.utils.js +3 -2
- package/package.json +3 -1
- package/server.utils.js +1 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// https://g40-server.instance.3clickscloud.com/swagger-ui/index.html#operations-tag-v1_-_Site_Settings_>_Style
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { threeclicksClient } = require('../threeclicks/threeclicks.utils');
|
|
6
|
+
|
|
7
|
+
const STYLE_CODE_TYPES = ['brand', 'category', 'collection', 'type'];
|
|
8
|
+
|
|
9
|
+
const codesForValidator = (codesFor) => STYLE_CODE_TYPES.includes(codesFor);
|
|
10
|
+
|
|
11
|
+
const argsWarden = new ArgsWarden([
|
|
12
|
+
['credsPayload', credsValidator],
|
|
13
|
+
['codesFor', codesForValidator],
|
|
14
|
+
]);
|
|
15
|
+
|
|
16
|
+
const threeclicksStyleCodesGet = async (credsPayload, codesFor) => {
|
|
17
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({ credsPayload, codesFor });
|
|
18
|
+
if (rejectResponse) return rejectResponse;
|
|
19
|
+
return threeclicksClient.fetch({
|
|
20
|
+
requestPayload: {
|
|
21
|
+
url: `/site-settings/style/${ codesFor }`,
|
|
22
|
+
method: 'get',
|
|
23
|
+
},
|
|
24
|
+
context: {
|
|
25
|
+
credsPayload,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const funcApiConfig = {
|
|
31
|
+
argsWarden,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
module.exports = {
|
|
35
|
+
threeclicksStyleCodesGet,
|
|
36
|
+
funcApiConfig,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/*
|
|
40
|
+
curl -X POST "http://localhost:8000/threeclicksStyleCodesGet" \
|
|
41
|
+
-H "Content-Type: application/json" \
|
|
42
|
+
-d '{
|
|
43
|
+
"credsPayload": { "credsPath": "threeclicks" },
|
|
44
|
+
"codesFor": "collection"
|
|
45
|
+
}'
|
|
46
|
+
*/
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// https://g40-server.instance.3clickscloud.com/swagger-ui/index.html#operations-v1_-_Style_>_Details-colourCreate
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { threeclicksClient } = require('../threeclicks/threeclicks.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['styleNumber'],
|
|
10
|
+
['colourPayload'],
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
const threeclicksStyleColourCreate = async (
|
|
14
|
+
credsPayload,
|
|
15
|
+
styleNumber,
|
|
16
|
+
colourPayload,
|
|
17
|
+
) => {
|
|
18
|
+
|
|
19
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
20
|
+
credsPayload,
|
|
21
|
+
styleNumber,
|
|
22
|
+
colourPayload,
|
|
23
|
+
});
|
|
24
|
+
if (rejectResponse) {
|
|
25
|
+
return rejectResponse;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return threeclicksClient.fetch({
|
|
29
|
+
requestPayload: {
|
|
30
|
+
url: `/style/basic/colour/${ styleNumber }`,
|
|
31
|
+
method: 'post',
|
|
32
|
+
body: colourPayload,
|
|
33
|
+
},
|
|
34
|
+
context: {
|
|
35
|
+
credsPayload,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const funcApiConfig = {
|
|
41
|
+
argsWarden,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
module.exports = {
|
|
45
|
+
threeclicksStyleColourCreate,
|
|
46
|
+
funcApiConfig,
|
|
47
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// https://g40-server.instance.3clickscloud.com/swagger-ui/index.html#operations-v1_-_Style_>_Details-colourDelete
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { threeclicksClient } = require('../threeclicks/threeclicks.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['styleNumber'],
|
|
10
|
+
['styleColoursizeId'],
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
const threeclicksStyleColourDelete = async (credsPayload, styleNumber, styleColoursizeId) => {
|
|
14
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({ credsPayload, styleNumber, styleColoursizeId });
|
|
15
|
+
if (rejectResponse) return rejectResponse;
|
|
16
|
+
return threeclicksClient.fetch({
|
|
17
|
+
requestPayload: {
|
|
18
|
+
url: `/style/basic/colour/${ styleNumber }/${ styleColoursizeId }`,
|
|
19
|
+
method: 'delete',
|
|
20
|
+
},
|
|
21
|
+
context: {
|
|
22
|
+
credsPayload,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const funcApiConfig = {
|
|
28
|
+
argsWarden,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
module.exports = {
|
|
32
|
+
threeclicksStyleColourDelete,
|
|
33
|
+
funcApiConfig,
|
|
34
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// https://g40-server.instance.3clickscloud.com/swagger-ui/index.html#operations-v1_-_Style-create
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { threeclicksClient } = require('../threeclicks/threeclicks.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['stylePayload'],
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
const threeclicksStyleCreate = async (
|
|
13
|
+
credsPayload,
|
|
14
|
+
stylePayload,
|
|
15
|
+
) => {
|
|
16
|
+
|
|
17
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
18
|
+
credsPayload,
|
|
19
|
+
stylePayload,
|
|
20
|
+
});
|
|
21
|
+
if (rejectResponse) {
|
|
22
|
+
return rejectResponse;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return threeclicksClient.fetch({
|
|
26
|
+
requestPayload: {
|
|
27
|
+
url: '/style',
|
|
28
|
+
method: 'post',
|
|
29
|
+
body: stylePayload,
|
|
30
|
+
},
|
|
31
|
+
context: {
|
|
32
|
+
credsPayload,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const funcApiConfig = {
|
|
38
|
+
argsWarden,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
module.exports = {
|
|
42
|
+
threeclicksStyleCreate,
|
|
43
|
+
funcApiConfig,
|
|
44
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// https://g40-server.instance.3clickscloud.com/swagger-ui/index.html#operations-v1_-_Style-delete
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { threeclicksClient } = require('../threeclicks/threeclicks.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['styleNumber'],
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
const threeclicksStyleDelete = async (credsPayload, styleNumber) => {
|
|
13
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({ credsPayload, styleNumber });
|
|
14
|
+
if (rejectResponse) return rejectResponse;
|
|
15
|
+
return threeclicksClient.fetch({
|
|
16
|
+
requestPayload: {
|
|
17
|
+
url: `/style/${ styleNumber }`,
|
|
18
|
+
method: 'delete',
|
|
19
|
+
},
|
|
20
|
+
context: {
|
|
21
|
+
credsPayload,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const funcApiConfig = {
|
|
27
|
+
argsWarden,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
module.exports = {
|
|
31
|
+
threeclicksStyleDelete,
|
|
32
|
+
funcApiConfig,
|
|
33
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// https://g40-server.instance.3clickscloud.com/swagger-ui/index.html#operations-v1_-_Style_>_Details-detail_4
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { threeclicksClient } = require('../threeclicks/threeclicks.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['styleNumber'],
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
const threeclicksStyleGet = async (
|
|
13
|
+
credsPayload,
|
|
14
|
+
styleNumber,
|
|
15
|
+
) => {
|
|
16
|
+
|
|
17
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
18
|
+
credsPayload,
|
|
19
|
+
styleNumber,
|
|
20
|
+
});
|
|
21
|
+
if (rejectResponse) {
|
|
22
|
+
return rejectResponse;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return threeclicksClient.fetch({
|
|
26
|
+
requestPayload: {
|
|
27
|
+
url: `/style/basic/${ styleNumber }`,
|
|
28
|
+
method: 'get',
|
|
29
|
+
},
|
|
30
|
+
context: {
|
|
31
|
+
credsPayload,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const funcApiConfig = {
|
|
37
|
+
argsWarden,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
module.exports = {
|
|
41
|
+
threeclicksStyleGet,
|
|
42
|
+
funcApiConfig,
|
|
43
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// https://g40-server.instance.3clickscloud.com/swagger-ui/index.html#operations-v1_-_Style_>_Details-updatePricing
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { threeclicksClient } = require('../threeclicks/threeclicks.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['styleNumber'],
|
|
10
|
+
['sizes'],
|
|
11
|
+
['buyPrice'],
|
|
12
|
+
['sellPrice'],
|
|
13
|
+
]);
|
|
14
|
+
|
|
15
|
+
const threeclicksStylePriceUpdate = async (
|
|
16
|
+
credsPayload,
|
|
17
|
+
styleNumber,
|
|
18
|
+
sizes,
|
|
19
|
+
buyPrice,
|
|
20
|
+
sellPrice,
|
|
21
|
+
{
|
|
22
|
+
currency = 'USD',
|
|
23
|
+
type = 'one_price',
|
|
24
|
+
option,
|
|
25
|
+
} = {},
|
|
26
|
+
) => {
|
|
27
|
+
|
|
28
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
29
|
+
credsPayload,
|
|
30
|
+
styleNumber,
|
|
31
|
+
sizes,
|
|
32
|
+
buyPrice,
|
|
33
|
+
sellPrice,
|
|
34
|
+
});
|
|
35
|
+
if (rejectResponse) {
|
|
36
|
+
return rejectResponse;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const body = {
|
|
40
|
+
sizes: sizes.map((size) => ({
|
|
41
|
+
size,
|
|
42
|
+
buy_price: [{ price: buyPrice, currency }],
|
|
43
|
+
sell_price: [{ price: sellPrice, currency }],
|
|
44
|
+
retail_price: [{ price: sellPrice, currency }],
|
|
45
|
+
alt_retail_price: [{ price: sellPrice, currency }],
|
|
46
|
+
})),
|
|
47
|
+
type,
|
|
48
|
+
...option && { option },
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
return threeclicksClient.fetch({
|
|
52
|
+
requestPayload: {
|
|
53
|
+
url: `/style/basic/pricing/${ styleNumber }`,
|
|
54
|
+
method: 'patch',
|
|
55
|
+
body,
|
|
56
|
+
},
|
|
57
|
+
context: {
|
|
58
|
+
credsPayload,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const funcApiConfig = {
|
|
64
|
+
argsWarden,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
module.exports = {
|
|
68
|
+
threeclicksStylePriceUpdate,
|
|
69
|
+
funcApiConfig,
|
|
70
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// https://g40-server.instance.3clickscloud.com/swagger-ui/index.html#operations-v1_-_Style_>_Details-update_2
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { threeclicksClient } = require('../threeclicks/threeclicks.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['styleNumber'],
|
|
10
|
+
['stylePayload'],
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
const threeclicksStyleUpdate = async (
|
|
14
|
+
credsPayload,
|
|
15
|
+
styleNumber,
|
|
16
|
+
stylePayload,
|
|
17
|
+
) => {
|
|
18
|
+
|
|
19
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
20
|
+
credsPayload,
|
|
21
|
+
styleNumber,
|
|
22
|
+
stylePayload,
|
|
23
|
+
});
|
|
24
|
+
if (rejectResponse) {
|
|
25
|
+
return rejectResponse;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return threeclicksClient.fetch({
|
|
29
|
+
requestPayload: {
|
|
30
|
+
url: `/style/basic/${ styleNumber }`,
|
|
31
|
+
method: 'patch',
|
|
32
|
+
body: stylePayload,
|
|
33
|
+
},
|
|
34
|
+
context: {
|
|
35
|
+
credsPayload,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const funcApiConfig = {
|
|
41
|
+
argsWarden,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
module.exports = {
|
|
45
|
+
threeclicksStyleUpdate,
|
|
46
|
+
funcApiConfig,
|
|
47
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// https://g40-server.instance.3clickscloud.com/swagger-ui/index.html#operations-v1_-_Search_>_Advanced-styleSearch
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { threeclicksGet } = require('../threeclicks/threeclicksGet');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
const threeclicksStylesGet = async (
|
|
12
|
+
credsPayload,
|
|
13
|
+
{
|
|
14
|
+
mode = 'all',
|
|
15
|
+
...getterOptions
|
|
16
|
+
} = {},
|
|
17
|
+
) => {
|
|
18
|
+
|
|
19
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({ credsPayload });
|
|
20
|
+
if (rejectResponse) {
|
|
21
|
+
return rejectResponse;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return threeclicksGet(credsPayload, '/search/advanced/style', {
|
|
25
|
+
params: { mode },
|
|
26
|
+
...getterOptions,
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const funcApiConfig = {
|
|
31
|
+
argsWarden,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
module.exports = {
|
|
35
|
+
threeclicksStylesGet,
|
|
36
|
+
funcApiConfig,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/*
|
|
40
|
+
curl -X POST "http://localhost:8000/threeclicksStylesGet" \
|
|
41
|
+
-H "Content-Type: application/json" \
|
|
42
|
+
-d '{
|
|
43
|
+
"credsPayload": { "credsPath": "threeclicks" }
|
|
44
|
+
}'
|
|
45
|
+
*/
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const { Redis } = require('@upstash/redis');
|
|
2
|
+
const { credsFromPayload } = require('../utils');
|
|
3
|
+
|
|
4
|
+
const UPSTASH_INSTANCES = new Map();
|
|
5
|
+
|
|
6
|
+
const getRedisCacheKey = (credsPayload) => JSON.stringify(credsPayload);
|
|
7
|
+
|
|
8
|
+
const getRedisInstance = async (credsPayload) => {
|
|
9
|
+
const key = getRedisCacheKey(credsPayload);
|
|
10
|
+
|
|
11
|
+
if (UPSTASH_INSTANCES.has(key)) {
|
|
12
|
+
return UPSTASH_INSTANCES.get(key);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const creds = await credsFromPayload(credsPayload);
|
|
16
|
+
const {
|
|
17
|
+
BASE_URL,
|
|
18
|
+
TOKEN,
|
|
19
|
+
} = creds;
|
|
20
|
+
|
|
21
|
+
if (!BASE_URL || !TOKEN) {
|
|
22
|
+
throw new Error('Missing Upstash creds');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const redis = new Redis({
|
|
26
|
+
url: BASE_URL,
|
|
27
|
+
token: TOKEN,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
UPSTASH_INSTANCES.set(key, redis);
|
|
31
|
+
return redis;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
module.exports = {
|
|
35
|
+
getRedisInstance,
|
|
36
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const { ArgsWarden } = require('../utils');
|
|
2
|
+
const { credsValidator } = require('../validators');
|
|
3
|
+
const { getRedisInstance } = require('../upstash/upstash.utils');
|
|
4
|
+
|
|
5
|
+
const argsWarden = new ArgsWarden([
|
|
6
|
+
['credsPayload', credsValidator],
|
|
7
|
+
['key'],
|
|
8
|
+
]);
|
|
9
|
+
|
|
10
|
+
const upstashDel = async (
|
|
11
|
+
credsPayload,
|
|
12
|
+
key,
|
|
13
|
+
) => {
|
|
14
|
+
|
|
15
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({ credsPayload, key });
|
|
16
|
+
if (rejectResponse) {
|
|
17
|
+
return rejectResponse;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const redis = await getRedisInstance(credsPayload);
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
const result = await redis.del(key);
|
|
24
|
+
return {
|
|
25
|
+
ok: true,
|
|
26
|
+
data: result,
|
|
27
|
+
};
|
|
28
|
+
} catch (error) {
|
|
29
|
+
console.error('upstashDel error', error);
|
|
30
|
+
return {
|
|
31
|
+
ok: false,
|
|
32
|
+
error: {
|
|
33
|
+
message: error.message,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const funcApiConfig = {
|
|
40
|
+
argsWarden,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
module.exports = {
|
|
44
|
+
upstashDel,
|
|
45
|
+
funcApiConfig,
|
|
46
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const { ArgsWarden } = require('../utils');
|
|
2
|
+
const { credsValidator } = require('../validators');
|
|
3
|
+
const { getRedisInstance } = require('../upstash/upstash.utils');
|
|
4
|
+
|
|
5
|
+
const argsWarden = new ArgsWarden([
|
|
6
|
+
['credsPayload', credsValidator],
|
|
7
|
+
['key'],
|
|
8
|
+
]);
|
|
9
|
+
|
|
10
|
+
const upstashExists = async (
|
|
11
|
+
credsPayload,
|
|
12
|
+
key,
|
|
13
|
+
) => {
|
|
14
|
+
|
|
15
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({ credsPayload, key });
|
|
16
|
+
if (rejectResponse) {
|
|
17
|
+
return rejectResponse;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const redis = await getRedisInstance(credsPayload);
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
const result = await redis.exists(key);
|
|
24
|
+
return {
|
|
25
|
+
ok: true,
|
|
26
|
+
data: result === 1,
|
|
27
|
+
};
|
|
28
|
+
} catch (error) {
|
|
29
|
+
console.error('upstashExists error', error);
|
|
30
|
+
return {
|
|
31
|
+
ok: false,
|
|
32
|
+
error: {
|
|
33
|
+
message: error.message,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const funcApiConfig = {
|
|
40
|
+
argsWarden,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
module.exports = {
|
|
44
|
+
upstashExists,
|
|
45
|
+
funcApiConfig,
|
|
46
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const { ArgsWarden } = require('../utils');
|
|
2
|
+
const { credsValidator } = require('../validators');
|
|
3
|
+
const { getRedisInstance } = require('../upstash/upstash.utils');
|
|
4
|
+
|
|
5
|
+
const argsWarden = new ArgsWarden([
|
|
6
|
+
['credsPayload', credsValidator],
|
|
7
|
+
['key'],
|
|
8
|
+
]);
|
|
9
|
+
|
|
10
|
+
const upstashGet = async (
|
|
11
|
+
credsPayload,
|
|
12
|
+
key,
|
|
13
|
+
) => {
|
|
14
|
+
|
|
15
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({ credsPayload, key });
|
|
16
|
+
if (rejectResponse) {
|
|
17
|
+
return rejectResponse;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const redis = await getRedisInstance(credsPayload);
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
const result = await redis.get(key);
|
|
24
|
+
return {
|
|
25
|
+
ok: true,
|
|
26
|
+
data: result,
|
|
27
|
+
};
|
|
28
|
+
} catch (error) {
|
|
29
|
+
console.error('upstashGet error', error);
|
|
30
|
+
return {
|
|
31
|
+
ok: false,
|
|
32
|
+
error: {
|
|
33
|
+
message: error.message,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const funcApiConfig = {
|
|
40
|
+
argsWarden,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
module.exports = {
|
|
44
|
+
upstashGet,
|
|
45
|
+
funcApiConfig,
|
|
46
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const { ArgsWarden } = require('../utils');
|
|
2
|
+
const { credsValidator } = require('../validators');
|
|
3
|
+
const { getRedisInstance } = require('../upstash/upstash.utils');
|
|
4
|
+
|
|
5
|
+
const argsWarden = new ArgsWarden([
|
|
6
|
+
['credsPayload', credsValidator],
|
|
7
|
+
['key'],
|
|
8
|
+
['value'],
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
const upstashSet = async (
|
|
12
|
+
credsPayload,
|
|
13
|
+
key,
|
|
14
|
+
value,
|
|
15
|
+
{
|
|
16
|
+
ex,
|
|
17
|
+
nx,
|
|
18
|
+
xx,
|
|
19
|
+
...upstashSetOptions
|
|
20
|
+
} = {},
|
|
21
|
+
) => {
|
|
22
|
+
|
|
23
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
24
|
+
credsPayload,
|
|
25
|
+
key,
|
|
26
|
+
value,
|
|
27
|
+
});
|
|
28
|
+
if (rejectResponse) {
|
|
29
|
+
return rejectResponse;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const redis = await getRedisInstance(credsPayload);
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
const result = await redis.set(key, value, {
|
|
36
|
+
...(ex !== undefined && { ex }),
|
|
37
|
+
...(nx !== undefined && { nx }),
|
|
38
|
+
...(xx !== undefined && { xx }),
|
|
39
|
+
...upstashSetOptions,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
ok: true,
|
|
44
|
+
data: result,
|
|
45
|
+
};
|
|
46
|
+
} catch (error) {
|
|
47
|
+
console.error('upstashSet error', error);
|
|
48
|
+
return {
|
|
49
|
+
ok: false,
|
|
50
|
+
error: {
|
|
51
|
+
message: error.message,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const funcApiConfig = {
|
|
58
|
+
argsWarden,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
module.exports = {
|
|
62
|
+
upstashSet,
|
|
63
|
+
funcApiConfig,
|
|
64
|
+
};
|