@foxtware/mineral 0.1.16 → 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/etsyListingInventoryUpdate.js +11 -11
- 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 +167 -0
- 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/hosting/deployFromHostingYml.js +2 -2
- package/hosting/execCommand.js +19 -2
- package/package.json +1 -1
- package/server.utils.js +1 -1
|
@@ -0,0 +1,92 @@
|
|
|
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 linearProjectCreate = async (
|
|
13
|
+
credsPayload,
|
|
14
|
+
input,
|
|
15
|
+
{
|
|
16
|
+
aiConversationId,
|
|
17
|
+
projectDraftId,
|
|
18
|
+
slackChannelName,
|
|
19
|
+
inspect = false,
|
|
20
|
+
fetchClient = linearClient,
|
|
21
|
+
} = {},
|
|
22
|
+
) => {
|
|
23
|
+
|
|
24
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
25
|
+
credsPayload,
|
|
26
|
+
input,
|
|
27
|
+
});
|
|
28
|
+
if (rejectResponse) {
|
|
29
|
+
return rejectResponse;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return fetchClient.fetch({
|
|
33
|
+
requestPayload: {
|
|
34
|
+
body: {
|
|
35
|
+
query: `
|
|
36
|
+
mutation ProjectCreate(
|
|
37
|
+
$input: ProjectCreateInput!
|
|
38
|
+
$aiConversationId: String
|
|
39
|
+
$projectDraftId: String
|
|
40
|
+
$slackChannelName: String
|
|
41
|
+
) {
|
|
42
|
+
projectCreate(
|
|
43
|
+
input: $input
|
|
44
|
+
aiConversationId: $aiConversationId
|
|
45
|
+
projectDraftId: $projectDraftId
|
|
46
|
+
slackChannelName: $slackChannelName
|
|
47
|
+
) {
|
|
48
|
+
success
|
|
49
|
+
project {
|
|
50
|
+
id
|
|
51
|
+
name
|
|
52
|
+
url
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
`,
|
|
57
|
+
variables: {
|
|
58
|
+
input,
|
|
59
|
+
aiConversationId,
|
|
60
|
+
projectDraftId,
|
|
61
|
+
slackChannelName,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
context: {
|
|
66
|
+
credsPayload,
|
|
67
|
+
resultPath: 'data.projectCreate',
|
|
68
|
+
},
|
|
69
|
+
inspect,
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const funcApiConfig = {
|
|
74
|
+
argsWarden,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
module.exports = {
|
|
78
|
+
linearProjectCreate,
|
|
79
|
+
funcApiConfig,
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/*
|
|
83
|
+
curl -X POST "http://localhost:8000/linearProjectCreate" \
|
|
84
|
+
-H "Content-Type: application/json" \
|
|
85
|
+
-d '{
|
|
86
|
+
"credsPayload": { "credsPath": "linear" },
|
|
87
|
+
"input": {
|
|
88
|
+
"name": "Example project",
|
|
89
|
+
"teamIds": ["f2387dcd-61ac-49aa-8d7a-7f62a0b5cca0"]
|
|
90
|
+
}
|
|
91
|
+
}'
|
|
92
|
+
*/
|
|
@@ -0,0 +1,74 @@
|
|
|
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 linearProjectGet = 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
|
+
query ProjectGet($id: String!) {
|
|
34
|
+
project(id: $id) {
|
|
35
|
+
id
|
|
36
|
+
name
|
|
37
|
+
description
|
|
38
|
+
url
|
|
39
|
+
state
|
|
40
|
+
createdAt
|
|
41
|
+
updatedAt
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`,
|
|
45
|
+
variables: {
|
|
46
|
+
id,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
context: {
|
|
51
|
+
credsPayload,
|
|
52
|
+
resultPath: 'data.project',
|
|
53
|
+
},
|
|
54
|
+
inspect,
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const funcApiConfig = {
|
|
59
|
+
argsWarden,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
module.exports = {
|
|
63
|
+
linearProjectGet,
|
|
64
|
+
funcApiConfig,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/*
|
|
68
|
+
curl -X POST "http://localhost:8000/linearProjectGet" \
|
|
69
|
+
-H "Content-Type: application/json" \
|
|
70
|
+
-d '{
|
|
71
|
+
"credsPayload": { "credsPath": "linear" },
|
|
72
|
+
"id": "PROJECT_ID"
|
|
73
|
+
}'
|
|
74
|
+
*/
|
|
@@ -0,0 +1,80 @@
|
|
|
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
|
+
['id'],
|
|
10
|
+
['input', valueProvided],
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
const linearProjectUpdate = async (
|
|
14
|
+
credsPayload,
|
|
15
|
+
id,
|
|
16
|
+
input,
|
|
17
|
+
{
|
|
18
|
+
inspect = false,
|
|
19
|
+
fetchClient = linearClient,
|
|
20
|
+
} = {},
|
|
21
|
+
) => {
|
|
22
|
+
|
|
23
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
24
|
+
credsPayload,
|
|
25
|
+
id,
|
|
26
|
+
input,
|
|
27
|
+
});
|
|
28
|
+
if (rejectResponse) {
|
|
29
|
+
return rejectResponse;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return fetchClient.fetch({
|
|
33
|
+
requestPayload: {
|
|
34
|
+
body: {
|
|
35
|
+
query: `
|
|
36
|
+
mutation ProjectUpdate($id: String!, $input: ProjectUpdateInput!) {
|
|
37
|
+
projectUpdate(id: $id, input: $input) {
|
|
38
|
+
success
|
|
39
|
+
project {
|
|
40
|
+
id
|
|
41
|
+
name
|
|
42
|
+
url
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
`,
|
|
47
|
+
variables: {
|
|
48
|
+
id,
|
|
49
|
+
input,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
context: {
|
|
54
|
+
credsPayload,
|
|
55
|
+
resultPath: 'data.projectUpdate',
|
|
56
|
+
},
|
|
57
|
+
inspect,
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const funcApiConfig = {
|
|
62
|
+
argsWarden,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
module.exports = {
|
|
66
|
+
linearProjectUpdate,
|
|
67
|
+
funcApiConfig,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/*
|
|
71
|
+
curl -X POST "http://localhost:8000/linearProjectUpdate" \
|
|
72
|
+
-H "Content-Type: application/json" \
|
|
73
|
+
-d '{
|
|
74
|
+
"credsPayload": { "credsPath": "linear" },
|
|
75
|
+
"id": "PROJECT_ID",
|
|
76
|
+
"input": {
|
|
77
|
+
"name": "Updated project"
|
|
78
|
+
}
|
|
79
|
+
}'
|
|
80
|
+
*/
|
|
@@ -0,0 +1,71 @@
|
|
|
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 linearProjectsGet = async (
|
|
12
|
+
returnGetter,
|
|
13
|
+
|
|
14
|
+
credsPayload,
|
|
15
|
+
{
|
|
16
|
+
attrs = `
|
|
17
|
+
id
|
|
18
|
+
name
|
|
19
|
+
description
|
|
20
|
+
url
|
|
21
|
+
state
|
|
22
|
+
createdAt
|
|
23
|
+
updatedAt
|
|
24
|
+
`,
|
|
25
|
+
sortType = true,
|
|
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
|
+
'project',
|
|
40
|
+
{
|
|
41
|
+
attrs,
|
|
42
|
+
sortType,
|
|
43
|
+
...getterOptions,
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
return returnGetter
|
|
48
|
+
? linearGetter(...getterArgs)
|
|
49
|
+
: linearGet(...getterArgs);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const funcApiConfig = {
|
|
53
|
+
argsWarden,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
module.exports = {
|
|
57
|
+
linearProjectsGet: linearProjectsGet.bind(null, false),
|
|
58
|
+
linearProjectsGetter: linearProjectsGet.bind(null, true),
|
|
59
|
+
funcApiConfig,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
curl -X POST "http://localhost:8000/linearProjectsGet" \
|
|
64
|
+
-H "Content-Type: application/json" \
|
|
65
|
+
-d '{
|
|
66
|
+
"credsPayload": { "credsPath": "linear" },
|
|
67
|
+
"options": {
|
|
68
|
+
"limit": 10
|
|
69
|
+
}
|
|
70
|
+
}'
|
|
71
|
+
*/
|
|
@@ -0,0 +1,71 @@
|
|
|
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 linearTeamGet = 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
|
+
query TeamGet($id: String!) {
|
|
34
|
+
team(id: $id) {
|
|
35
|
+
id
|
|
36
|
+
name
|
|
37
|
+
key
|
|
38
|
+
description
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
`,
|
|
42
|
+
variables: {
|
|
43
|
+
id,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
context: {
|
|
48
|
+
credsPayload,
|
|
49
|
+
resultPath: 'data.team',
|
|
50
|
+
},
|
|
51
|
+
inspect,
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const funcApiConfig = {
|
|
56
|
+
argsWarden,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
module.exports = {
|
|
60
|
+
linearTeamGet,
|
|
61
|
+
funcApiConfig,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/*
|
|
65
|
+
curl -X POST "http://localhost:8000/linearTeamGet" \
|
|
66
|
+
-H "Content-Type: application/json" \
|
|
67
|
+
-d '{
|
|
68
|
+
"credsPayload": { "credsPath": "linear" },
|
|
69
|
+
"id": "f2387dcd-61ac-49aa-8d7a-7f62a0b5cca0"
|
|
70
|
+
}'
|
|
71
|
+
*/
|
|
@@ -0,0 +1,66 @@
|
|
|
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 linearTeamsGet = async (
|
|
12
|
+
returnGetter,
|
|
13
|
+
|
|
14
|
+
credsPayload,
|
|
15
|
+
{
|
|
16
|
+
attrs = `
|
|
17
|
+
id
|
|
18
|
+
name
|
|
19
|
+
key
|
|
20
|
+
description
|
|
21
|
+
`,
|
|
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
|
+
'team',
|
|
36
|
+
{
|
|
37
|
+
attrs,
|
|
38
|
+
...getterOptions,
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
return returnGetter
|
|
43
|
+
? linearGetter(...getterArgs)
|
|
44
|
+
: linearGet(...getterArgs);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const funcApiConfig = {
|
|
48
|
+
argsWarden,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
module.exports = {
|
|
52
|
+
linearTeamsGet: linearTeamsGet.bind(null, false),
|
|
53
|
+
linearTeamsGetter: linearTeamsGet.bind(null, true),
|
|
54
|
+
funcApiConfig,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/*
|
|
58
|
+
curl -X POST "http://localhost:8000/linearTeamsGet" \
|
|
59
|
+
-H "Content-Type: application/json" \
|
|
60
|
+
-d '{
|
|
61
|
+
"credsPayload": { "credsPath": "linear" },
|
|
62
|
+
"options": {
|
|
63
|
+
"limit": 10
|
|
64
|
+
}
|
|
65
|
+
}'
|
|
66
|
+
*/
|
|
@@ -0,0 +1,72 @@
|
|
|
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 linearUserGet = 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
|
+
query UserGet($id: String!) {
|
|
34
|
+
user(id: $id) {
|
|
35
|
+
id
|
|
36
|
+
name
|
|
37
|
+
displayName
|
|
38
|
+
email
|
|
39
|
+
active
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
`,
|
|
43
|
+
variables: {
|
|
44
|
+
id,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
context: {
|
|
49
|
+
credsPayload,
|
|
50
|
+
resultPath: 'data.user',
|
|
51
|
+
},
|
|
52
|
+
inspect,
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const funcApiConfig = {
|
|
57
|
+
argsWarden,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
module.exports = {
|
|
61
|
+
linearUserGet,
|
|
62
|
+
funcApiConfig,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/*
|
|
66
|
+
curl -X POST "http://localhost:8000/linearUserGet" \
|
|
67
|
+
-H "Content-Type: application/json" \
|
|
68
|
+
-d '{
|
|
69
|
+
"credsPayload": { "credsPath": "linear" },
|
|
70
|
+
"id": "b2c2e616-384b-4f0e-afb2-2e50839179e2"
|
|
71
|
+
}'
|
|
72
|
+
*/
|
|
@@ -0,0 +1,71 @@
|
|
|
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 linearUsersGet = async (
|
|
12
|
+
returnGetter,
|
|
13
|
+
|
|
14
|
+
credsPayload,
|
|
15
|
+
{
|
|
16
|
+
attrs = `
|
|
17
|
+
id
|
|
18
|
+
name
|
|
19
|
+
displayName
|
|
20
|
+
email
|
|
21
|
+
active
|
|
22
|
+
`,
|
|
23
|
+
sortType = true,
|
|
24
|
+
supportsIncludeDisabled = true,
|
|
25
|
+
...getterOptions
|
|
26
|
+
} = {},
|
|
27
|
+
) => {
|
|
28
|
+
|
|
29
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
30
|
+
credsPayload,
|
|
31
|
+
});
|
|
32
|
+
if (rejectResponse) {
|
|
33
|
+
return rejectResponse;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const getterArgs = [
|
|
37
|
+
credsPayload,
|
|
38
|
+
'user',
|
|
39
|
+
{
|
|
40
|
+
attrs,
|
|
41
|
+
sortType,
|
|
42
|
+
supportsIncludeDisabled,
|
|
43
|
+
...getterOptions,
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
return returnGetter
|
|
48
|
+
? linearGetter(...getterArgs)
|
|
49
|
+
: linearGet(...getterArgs);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const funcApiConfig = {
|
|
53
|
+
argsWarden,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
module.exports = {
|
|
57
|
+
linearUsersGet: linearUsersGet.bind(null, false),
|
|
58
|
+
linearUsersGetter: linearUsersGet.bind(null, true),
|
|
59
|
+
funcApiConfig,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
curl -X POST "http://localhost:8000/linearUsersGet" \
|
|
64
|
+
-H "Content-Type: application/json" \
|
|
65
|
+
-d '{
|
|
66
|
+
"credsPayload": { "credsPath": "linear" },
|
|
67
|
+
"options": {
|
|
68
|
+
"limit": 10
|
|
69
|
+
}
|
|
70
|
+
}'
|
|
71
|
+
*/
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
]);
|
|
10
|
+
|
|
11
|
+
const linearViewerGet = async (
|
|
12
|
+
credsPayload,
|
|
13
|
+
{
|
|
14
|
+
inspect = false,
|
|
15
|
+
fetchClient = linearClient,
|
|
16
|
+
} = {},
|
|
17
|
+
) => {
|
|
18
|
+
|
|
19
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
20
|
+
credsPayload,
|
|
21
|
+
});
|
|
22
|
+
if (rejectResponse) {
|
|
23
|
+
return rejectResponse;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return fetchClient.fetch({
|
|
27
|
+
requestPayload: {
|
|
28
|
+
body: {
|
|
29
|
+
query: `
|
|
30
|
+
query ViewerGet {
|
|
31
|
+
viewer {
|
|
32
|
+
id
|
|
33
|
+
name
|
|
34
|
+
displayName
|
|
35
|
+
email
|
|
36
|
+
active
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
context: {
|
|
43
|
+
credsPayload,
|
|
44
|
+
resultPath: 'data.viewer',
|
|
45
|
+
},
|
|
46
|
+
inspect,
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const funcApiConfig = {
|
|
51
|
+
argsWarden,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
module.exports = {
|
|
55
|
+
linearViewerGet,
|
|
56
|
+
funcApiConfig,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/*
|
|
60
|
+
curl -X POST "http://localhost:8000/linearViewerGet" \
|
|
61
|
+
-H "Content-Type: application/json" \
|
|
62
|
+
-d '{
|
|
63
|
+
"credsPayload": { "credsPath": "linear" }
|
|
64
|
+
}'
|
|
65
|
+
*/
|