@foxtware/mineral 0.1.17 → 0.1.18
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 +16 -7
- package/AGENTS.md +3 -0
- package/_build_scripts/publish.js +15 -1
- package/api/backblaze/backblaze.constants.js +11 -0
- package/api/backblaze/backblaze.utils.js +322 -0
- package/api/backblaze/backblazeBucketsGet.js +68 -0
- package/api/backblaze/backblazeFileDelete.js +62 -0
- package/api/backblaze/backblazeFileHide.js +62 -0
- package/api/backblaze/backblazeFileUpload.js +142 -0
- package/api/backblaze/backblazeFilesGet.js +85 -0
- package/api/backblaze/backblazeGet.js +139 -0
- package/api/backblaze/docs.md +6 -0
- package/api/etsy/etsyListingUpdate.js +1 -1
- package/api/gorgias/gorgias.constants.js +8 -0
- package/api/gorgias/gorgias.utils.js +46 -0
- package/api/gorgias/gorgiasAccountGet.js +51 -0
- package/api/gorgias/gorgiasCustomerGet.js +70 -0
- package/api/gorgias/gorgiasCustomersGet.js +56 -0
- package/api/gorgias/gorgiasGet.js +150 -0
- package/api/gorgias/gorgiasGetSingle.js +26 -0
- package/api/gorgias/gorgiasMessagesGet.js +56 -0
- package/api/gorgias/gorgiasTagsGet.js +52 -0
- package/api/gorgias/gorgiasTicketCreate.js +66 -0
- package/api/gorgias/gorgiasTicketGet.js +70 -0
- package/api/gorgias/gorgiasTicketMessageCreate.js +65 -0
- package/api/gorgias/gorgiasTicketMessagesGet.js +66 -0
- package/api/gorgias/gorgiasTicketUpdate.js +62 -0
- package/api/gorgias/gorgiasTicketsGet.js +58 -0
- package/api/gorgias/gorgiasUsersGet.js +52 -0
- package/api/gorgias/gorgiasViewItemsGet.js +57 -0
- package/api/gorgias/gorgiasViewsGet.js +72 -0
- package/api/linear/docs.md +6 -0
- package/api/linear/linear.constants.js +3 -0
- package/api/linear/linear.utils.js +59 -0
- package/api/linear/linearAttachmentCreate.js +77 -0
- package/api/linear/linearAttachmentDelete.js +68 -0
- package/api/linear/linearCommentCreate.js +77 -0
- package/api/linear/linearCommentDelete.js +68 -0
- package/api/linear/linearCommentGet.js +77 -0
- package/api/linear/linearCommentUpdate.js +87 -0
- package/api/linear/linearCommentsGet.js +70 -0
- package/api/linear/linearCyclesGet.js +67 -0
- package/api/linear/linearGet.js +218 -0
- package/api/linear/linearIssueAddLabel.js +77 -0
- package/api/linear/linearIssueArchive.js +74 -0
- package/api/linear/linearIssueCreate.js +94 -0
- package/api/linear/linearIssueDelete.js +74 -0
- package/api/linear/linearIssueGet.js +87 -0
- package/api/linear/linearIssueLabelCreate.js +81 -0
- package/api/linear/linearIssueLabelsGet.js +66 -0
- package/api/linear/linearIssueRemoveLabel.js +77 -0
- package/api/linear/linearIssueUpdate.js +96 -0
- package/api/linear/linearIssuesGet.js +39 -63
- package/api/linear/linearOrganizationGet.js +64 -0
- package/api/linear/linearProjectCreate.js +92 -0
- package/api/linear/linearProjectGet.js +74 -0
- package/api/linear/linearProjectUpdate.js +80 -0
- package/api/linear/linearProjectsGet.js +71 -0
- package/api/linear/linearTeamGet.js +71 -0
- package/api/linear/linearTeamsGet.js +66 -0
- package/api/linear/linearUserGet.js +72 -0
- package/api/linear/linearUsersGet.js +71 -0
- package/api/linear/linearViewerGet.js +65 -0
- package/api/linear/linearWebhookCreate.js +77 -0
- package/api/linear/linearWebhookDelete.js +68 -0
- package/api/linear/linearWebhooksGet.js +67 -0
- package/api/linear/linearWorkflowStatesGet.js +73 -0
- package/api/pipe17/pipe17.utils.js +7 -20
- package/api/pipe17/pipe17ArrivalGet.js +1 -1
- package/api/pipe17/pipe17FulfillmentGet.js +1 -1
- package/api/pipe17/pipe17InventoryItemGet.js +1 -1
- package/api/pipe17/pipe17JobGet.js +11 -24
- package/api/pipe17/pipe17LocationGet.js +1 -1
- package/api/pipe17/pipe17OrderGet.js +1 -1
- package/api/pipe17/pipe17ProductGet.js +1 -1
- package/api/pipe17/pipe17PurchaseGet.js +1 -1
- package/api/pipe17/pipe17ReceiptGet.js +1 -1
- package/api/pipe17/pipe17ReturnGet.js +1 -1
- package/api/shopify/shopifyFileCreate.js +107 -0
- package/api/shopify/shopifyMetafieldDefinitionCreate.js +2 -0
- package/api/shopify/shopifyMetafieldDefinitionGet.js +108 -0
- package/api/shopify/shopifyMetafieldDefinitionPropagate.js +27 -71
- package/api/shopify/shopifyThemeFileGet.js +112 -0
- package/api/shopify/shopifyThemeFilePropagate.js +410 -0
- package/api/shopify/shopifyThemeFilesUpsert.js +88 -0
- package/api/starshipit/starshipit.utils.js +1 -0
- package/api/starshipit/starshipitOrderGet.js +2 -10
- package/api/utils.js +12 -4
- package/package.json +1 -1
- package/server.utils.js +1 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// https://linear.app/developers/graphql
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden, valueProvided } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { linearClient } = require('../linear/linear.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['input', valueProvided],
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
const linearWebhookCreate = async (
|
|
13
|
+
credsPayload,
|
|
14
|
+
input,
|
|
15
|
+
{
|
|
16
|
+
inspect = false,
|
|
17
|
+
fetchClient = linearClient,
|
|
18
|
+
} = {},
|
|
19
|
+
) => {
|
|
20
|
+
|
|
21
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
22
|
+
credsPayload,
|
|
23
|
+
input,
|
|
24
|
+
});
|
|
25
|
+
if (rejectResponse) {
|
|
26
|
+
return rejectResponse;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return fetchClient.fetch({
|
|
30
|
+
requestPayload: {
|
|
31
|
+
body: {
|
|
32
|
+
query: `
|
|
33
|
+
mutation WebhookCreate($input: WebhookCreateInput!) {
|
|
34
|
+
webhookCreate(input: $input) {
|
|
35
|
+
success
|
|
36
|
+
webhook {
|
|
37
|
+
id
|
|
38
|
+
url
|
|
39
|
+
enabled
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
`,
|
|
44
|
+
variables: {
|
|
45
|
+
input,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
context: {
|
|
50
|
+
credsPayload,
|
|
51
|
+
resultPath: 'data.webhookCreate',
|
|
52
|
+
},
|
|
53
|
+
inspect,
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const funcApiConfig = {
|
|
58
|
+
argsWarden,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
module.exports = {
|
|
62
|
+
linearWebhookCreate,
|
|
63
|
+
funcApiConfig,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/*
|
|
67
|
+
curl -X POST "http://localhost:8000/linearWebhookCreate" \
|
|
68
|
+
-H "Content-Type: application/json" \
|
|
69
|
+
-d '{
|
|
70
|
+
"credsPayload": { "credsPath": "linear" },
|
|
71
|
+
"input": {
|
|
72
|
+
"url": "https://example.com/hooks/linear",
|
|
73
|
+
"teamId": "f2387dcd-61ac-49aa-8d7a-7f62a0b5cca0",
|
|
74
|
+
"resourceTypes": ["Issue"]
|
|
75
|
+
}
|
|
76
|
+
}'
|
|
77
|
+
*/
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// https://linear.app/developers/graphql
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { linearClient } = require('../linear/linear.utils');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
['id'],
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
const linearWebhookDelete = async (
|
|
13
|
+
credsPayload,
|
|
14
|
+
id,
|
|
15
|
+
{
|
|
16
|
+
inspect = false,
|
|
17
|
+
fetchClient = linearClient,
|
|
18
|
+
} = {},
|
|
19
|
+
) => {
|
|
20
|
+
|
|
21
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
22
|
+
credsPayload,
|
|
23
|
+
id,
|
|
24
|
+
});
|
|
25
|
+
if (rejectResponse) {
|
|
26
|
+
return rejectResponse;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return fetchClient.fetch({
|
|
30
|
+
requestPayload: {
|
|
31
|
+
body: {
|
|
32
|
+
query: `
|
|
33
|
+
mutation WebhookDelete($id: String!) {
|
|
34
|
+
webhookDelete(id: $id) {
|
|
35
|
+
success
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
`,
|
|
39
|
+
variables: {
|
|
40
|
+
id,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
context: {
|
|
45
|
+
credsPayload,
|
|
46
|
+
resultPath: 'data.webhookDelete',
|
|
47
|
+
},
|
|
48
|
+
inspect,
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const funcApiConfig = {
|
|
53
|
+
argsWarden,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
module.exports = {
|
|
57
|
+
linearWebhookDelete,
|
|
58
|
+
funcApiConfig,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/*
|
|
62
|
+
curl -X POST "http://localhost:8000/linearWebhookDelete" \
|
|
63
|
+
-H "Content-Type: application/json" \
|
|
64
|
+
-d '{
|
|
65
|
+
"credsPayload": { "credsPath": "linear" },
|
|
66
|
+
"id": "WEBHOOK_ID"
|
|
67
|
+
}'
|
|
68
|
+
*/
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// https://linear.app/developers/graphql
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { linearGet, linearGetter } = require('./linearGet');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
const linearWebhooksGet = async (
|
|
12
|
+
returnGetter,
|
|
13
|
+
|
|
14
|
+
credsPayload,
|
|
15
|
+
{
|
|
16
|
+
attrs = `
|
|
17
|
+
id
|
|
18
|
+
url
|
|
19
|
+
enabled
|
|
20
|
+
`,
|
|
21
|
+
filterType = null,
|
|
22
|
+
...getterOptions
|
|
23
|
+
} = {},
|
|
24
|
+
) => {
|
|
25
|
+
|
|
26
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
27
|
+
credsPayload,
|
|
28
|
+
});
|
|
29
|
+
if (rejectResponse) {
|
|
30
|
+
return rejectResponse;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const getterArgs = [
|
|
34
|
+
credsPayload,
|
|
35
|
+
'webhook',
|
|
36
|
+
{
|
|
37
|
+
attrs,
|
|
38
|
+
filterType,
|
|
39
|
+
...getterOptions,
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
return returnGetter
|
|
44
|
+
? linearGetter(...getterArgs)
|
|
45
|
+
: linearGet(...getterArgs);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const funcApiConfig = {
|
|
49
|
+
argsWarden,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
module.exports = {
|
|
53
|
+
linearWebhooksGet: linearWebhooksGet.bind(null, false),
|
|
54
|
+
linearWebhooksGetter: linearWebhooksGet.bind(null, true),
|
|
55
|
+
funcApiConfig,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/*
|
|
59
|
+
curl -X POST "http://localhost:8000/linearWebhooksGet" \
|
|
60
|
+
-H "Content-Type: application/json" \
|
|
61
|
+
-d '{
|
|
62
|
+
"credsPayload": { "credsPath": "linear" },
|
|
63
|
+
"options": {
|
|
64
|
+
"limit": 10
|
|
65
|
+
}
|
|
66
|
+
}'
|
|
67
|
+
*/
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// https://linear.app/developers/graphql
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { linearGet, linearGetter } = require('./linearGet');
|
|
6
|
+
|
|
7
|
+
const argsWarden = new ArgsWarden([
|
|
8
|
+
['credsPayload', credsValidator],
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
const linearWorkflowStatesGet = async (
|
|
12
|
+
returnGetter,
|
|
13
|
+
|
|
14
|
+
credsPayload,
|
|
15
|
+
{
|
|
16
|
+
attrs = `
|
|
17
|
+
id
|
|
18
|
+
name
|
|
19
|
+
type
|
|
20
|
+
position
|
|
21
|
+
team {
|
|
22
|
+
id
|
|
23
|
+
name
|
|
24
|
+
}
|
|
25
|
+
`,
|
|
26
|
+
...getterOptions
|
|
27
|
+
} = {},
|
|
28
|
+
) => {
|
|
29
|
+
|
|
30
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
31
|
+
credsPayload,
|
|
32
|
+
});
|
|
33
|
+
if (rejectResponse) {
|
|
34
|
+
return rejectResponse;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const getterArgs = [
|
|
38
|
+
credsPayload,
|
|
39
|
+
'workflowState',
|
|
40
|
+
{
|
|
41
|
+
attrs,
|
|
42
|
+
...getterOptions,
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
return returnGetter
|
|
47
|
+
? linearGetter(...getterArgs)
|
|
48
|
+
: linearGet(...getterArgs);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const funcApiConfig = {
|
|
52
|
+
argsWarden,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
module.exports = {
|
|
56
|
+
linearWorkflowStatesGet: linearWorkflowStatesGet.bind(null, false),
|
|
57
|
+
linearWorkflowStatesGetter: linearWorkflowStatesGet.bind(null, true),
|
|
58
|
+
funcApiConfig,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/*
|
|
62
|
+
curl -X POST "http://localhost:8000/linearWorkflowStatesGet" \
|
|
63
|
+
-H "Content-Type: application/json" \
|
|
64
|
+
-d '{
|
|
65
|
+
"credsPayload": { "credsPath": "linear" },
|
|
66
|
+
"options": {
|
|
67
|
+
"limit": 20,
|
|
68
|
+
"filter": {
|
|
69
|
+
"team": { "id": { "eq": "f2387dcd-61ac-49aa-8d7a-7f62a0b5cca0" } }
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}'
|
|
73
|
+
*/
|
|
@@ -75,6 +75,7 @@ const pipe17Client = new FetchClient({
|
|
|
75
75
|
'fetch',
|
|
76
76
|
fetchClientCommonSteps.exitEarlyOnNotOk,
|
|
77
77
|
interpretPipe17Response,
|
|
78
|
+
fetchClientCommonSteps.digToPath,
|
|
78
79
|
],
|
|
79
80
|
});
|
|
80
81
|
|
|
@@ -83,37 +84,23 @@ const pipe17GetSingle = async (
|
|
|
83
84
|
collectionPath,
|
|
84
85
|
id,
|
|
85
86
|
{
|
|
86
|
-
|
|
87
|
+
resultPath,
|
|
87
88
|
inspect = false,
|
|
88
89
|
fetchClient = pipe17Client,
|
|
89
90
|
} = {},
|
|
90
91
|
) => {
|
|
91
92
|
|
|
92
|
-
|
|
93
|
+
return fetchClient.fetch({
|
|
93
94
|
requestPayload: {
|
|
94
95
|
method: 'get',
|
|
95
96
|
url: `${ collectionPath }/${ id }`,
|
|
96
97
|
},
|
|
97
|
-
context: {
|
|
98
|
+
context: {
|
|
99
|
+
credsPayload,
|
|
100
|
+
resultPath,
|
|
101
|
+
},
|
|
98
102
|
inspect,
|
|
99
103
|
});
|
|
100
|
-
|
|
101
|
-
if (!response.ok) {
|
|
102
|
-
return response;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const resolvedResultKey = resultKey ?? collectionPath.replace(/^\//, '').replace(/s$/, '');
|
|
106
|
-
const entity = response.data?.result?.[resolvedResultKey]
|
|
107
|
-
?? response.data?.[resolvedResultKey];
|
|
108
|
-
|
|
109
|
-
if (entity !== undefined) {
|
|
110
|
-
return {
|
|
111
|
-
...response,
|
|
112
|
-
data: entity,
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return response;
|
|
117
104
|
};
|
|
118
105
|
|
|
119
106
|
module.exports = {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const { ArgsWarden } = require('../utils');
|
|
4
4
|
const { credsValidator } = require('../validators');
|
|
5
|
-
const {
|
|
5
|
+
const { pipe17GetSingle } = require('../pipe17/pipe17.utils');
|
|
6
6
|
|
|
7
7
|
const argsWarden = new ArgsWarden([
|
|
8
8
|
['credsPayload', credsValidator],
|
|
@@ -14,7 +14,7 @@ const pipe17JobGet = async (
|
|
|
14
14
|
jobId,
|
|
15
15
|
{
|
|
16
16
|
inspect = false,
|
|
17
|
-
fetchClient
|
|
17
|
+
fetchClient,
|
|
18
18
|
} = {},
|
|
19
19
|
) => {
|
|
20
20
|
|
|
@@ -26,29 +26,16 @@ const pipe17JobGet = async (
|
|
|
26
26
|
return rejectResponse;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
return pipe17GetSingle(
|
|
30
|
+
credsPayload,
|
|
31
|
+
'/jobs',
|
|
32
|
+
jobId,
|
|
33
|
+
{
|
|
34
|
+
resultPath: 'result.job',
|
|
35
|
+
inspect,
|
|
36
|
+
fetchClient,
|
|
33
37
|
},
|
|
34
|
-
|
|
35
|
-
inspect,
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
if (!response.ok) {
|
|
39
|
-
return response;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const job = response.data?.result?.job
|
|
43
|
-
?? response.data?.job;
|
|
44
|
-
if (job !== undefined) {
|
|
45
|
-
return {
|
|
46
|
-
...response,
|
|
47
|
-
data: job,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return response;
|
|
38
|
+
);
|
|
52
39
|
};
|
|
53
40
|
|
|
54
41
|
const funcApiConfig = {
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// https://shopify.dev/docs/api/admin-graphql/latest/mutations/fileCreate
|
|
2
|
+
|
|
3
|
+
const { credsValidator } = require('../validators');
|
|
4
|
+
const { ArgsWarden, ensureArray, everyIfArray } = require('../utils');
|
|
5
|
+
const { shopifyMutationDo } = require('./shopifyMutationDo');
|
|
6
|
+
|
|
7
|
+
const fileInputValidator = ({ originalSource } = {}) => Boolean(originalSource);
|
|
8
|
+
|
|
9
|
+
const defaultReturnFileAttrs = `
|
|
10
|
+
id
|
|
11
|
+
fileStatus
|
|
12
|
+
alt
|
|
13
|
+
fileErrors {
|
|
14
|
+
code
|
|
15
|
+
details
|
|
16
|
+
message
|
|
17
|
+
}
|
|
18
|
+
preview {
|
|
19
|
+
image {
|
|
20
|
+
url
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
... on MediaImage {
|
|
24
|
+
image {
|
|
25
|
+
url
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
... on GenericFile {
|
|
29
|
+
url
|
|
30
|
+
}
|
|
31
|
+
... on Video {
|
|
32
|
+
originalSource {
|
|
33
|
+
url
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
`.trim();
|
|
37
|
+
|
|
38
|
+
const argsWarden = new ArgsWarden([
|
|
39
|
+
['credsPayload', credsValidator],
|
|
40
|
+
['fileInput', (fileInput) => everyIfArray(fileInputValidator, fileInput)],
|
|
41
|
+
]);
|
|
42
|
+
|
|
43
|
+
const shopifyFileCreate = async (
|
|
44
|
+
credsPayload,
|
|
45
|
+
fileInput,
|
|
46
|
+
{
|
|
47
|
+
apiVersion,
|
|
48
|
+
returnFileAttrs = defaultReturnFileAttrs,
|
|
49
|
+
} = {},
|
|
50
|
+
) => {
|
|
51
|
+
|
|
52
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
53
|
+
credsPayload,
|
|
54
|
+
fileInput,
|
|
55
|
+
});
|
|
56
|
+
if (rejectResponse) {
|
|
57
|
+
return rejectResponse;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return shopifyMutationDo(
|
|
61
|
+
credsPayload,
|
|
62
|
+
'fileCreate',
|
|
63
|
+
{
|
|
64
|
+
mutationVariables: {
|
|
65
|
+
files: {
|
|
66
|
+
type: '[FileCreateInput!]!',
|
|
67
|
+
value: ensureArray(fileInput).map(({
|
|
68
|
+
filename,
|
|
69
|
+
originalSource,
|
|
70
|
+
contentType,
|
|
71
|
+
alt,
|
|
72
|
+
duplicateResolutionMode,
|
|
73
|
+
}) => ({
|
|
74
|
+
originalSource,
|
|
75
|
+
...(filename && { filename }),
|
|
76
|
+
...(contentType && { contentType }),
|
|
77
|
+
...(alt && { alt }),
|
|
78
|
+
...(duplicateResolutionMode && { duplicateResolutionMode }),
|
|
79
|
+
})),
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
returnSchema: `files { ${ returnFileAttrs } }`,
|
|
83
|
+
apiVersion,
|
|
84
|
+
},
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const funcApiConfig = {
|
|
89
|
+
argsWarden,
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
module.exports = {
|
|
93
|
+
shopifyFileCreate,
|
|
94
|
+
funcApiConfig,
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/*
|
|
98
|
+
curl -X POST "http://localhost:8000/shopifyFileCreate" \
|
|
99
|
+
-H "Content-Type: application/json" \
|
|
100
|
+
-d '{
|
|
101
|
+
"credsPayload": { "credsPath": "shopify.au" },
|
|
102
|
+
"fileInput": {
|
|
103
|
+
"originalSource": "https://upload.wikimedia.org/wikipedia/en/5/5f/Original_Doge_meme.jpg",
|
|
104
|
+
"filename": "doge.jpg"
|
|
105
|
+
}
|
|
106
|
+
}'
|
|
107
|
+
*/
|
|
@@ -39,6 +39,7 @@ const shopifyMetafieldDefinitionCreate = async (
|
|
|
39
39
|
pin,
|
|
40
40
|
useAsCollectionCondition,
|
|
41
41
|
validations,
|
|
42
|
+
capabilities,
|
|
42
43
|
returnSchema = defaultReturnSchema,
|
|
43
44
|
} = {},
|
|
44
45
|
) => {
|
|
@@ -73,6 +74,7 @@ const shopifyMetafieldDefinitionCreate = async (
|
|
|
73
74
|
...(pin && { pin }),
|
|
74
75
|
...(useAsCollectionCondition && { useAsCollectionCondition }),
|
|
75
76
|
...(validations && { validations }),
|
|
77
|
+
...(capabilities && { capabilities }),
|
|
76
78
|
},
|
|
77
79
|
},
|
|
78
80
|
},
|