@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,108 @@
|
|
|
1
|
+
// https://shopify.dev/docs/api/admin-graphql/latest/queries/metafieldDefinition
|
|
2
|
+
|
|
3
|
+
const { credsValidator } = require('../validators');
|
|
4
|
+
const { ArgsWarden, objHasAny } = require('../utils');
|
|
5
|
+
const { shopifyClient } = require('./shopify.utils');
|
|
6
|
+
|
|
7
|
+
const metafieldDefinitionIdentifierValidator = (metafieldDefinitionIdentifier) => {
|
|
8
|
+
return objHasAny(metafieldDefinitionIdentifier, [
|
|
9
|
+
'ownerType',
|
|
10
|
+
'namespace',
|
|
11
|
+
'key',
|
|
12
|
+
]);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const argsWarden = new ArgsWarden([
|
|
16
|
+
['credsPayload', credsValidator],
|
|
17
|
+
['metafieldDefinitionIdentifier', metafieldDefinitionIdentifierValidator],
|
|
18
|
+
]);
|
|
19
|
+
|
|
20
|
+
const defaultAttrs = `
|
|
21
|
+
name
|
|
22
|
+
namespace
|
|
23
|
+
key
|
|
24
|
+
description
|
|
25
|
+
ownerType
|
|
26
|
+
pinnedPosition
|
|
27
|
+
type {
|
|
28
|
+
name
|
|
29
|
+
}
|
|
30
|
+
validations {
|
|
31
|
+
name
|
|
32
|
+
value
|
|
33
|
+
}
|
|
34
|
+
capabilities {
|
|
35
|
+
adminFilterable {
|
|
36
|
+
enabled
|
|
37
|
+
}
|
|
38
|
+
smartCollectionCondition {
|
|
39
|
+
enabled
|
|
40
|
+
}
|
|
41
|
+
uniqueValues {
|
|
42
|
+
enabled
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
`.trim();
|
|
46
|
+
|
|
47
|
+
const shopifyMetafieldDefinitionGet = async (
|
|
48
|
+
credsPayload,
|
|
49
|
+
metafieldDefinitionIdentifier,
|
|
50
|
+
{
|
|
51
|
+
apiVersion,
|
|
52
|
+
attrs = defaultAttrs,
|
|
53
|
+
} = {},
|
|
54
|
+
) => {
|
|
55
|
+
|
|
56
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
57
|
+
credsPayload,
|
|
58
|
+
metafieldDefinitionIdentifier,
|
|
59
|
+
});
|
|
60
|
+
if (rejectResponse) {
|
|
61
|
+
return rejectResponse;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return shopifyClient.fetch({
|
|
65
|
+
requestPayload: {
|
|
66
|
+
method: 'post',
|
|
67
|
+
body: {
|
|
68
|
+
query: `
|
|
69
|
+
query GetMetafieldDefinition($identifier: MetafieldDefinitionIdentifierInput!) {
|
|
70
|
+
metafieldDefinition(identifier: $identifier) {
|
|
71
|
+
${ attrs }
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
`,
|
|
75
|
+
variables: {
|
|
76
|
+
identifier: metafieldDefinitionIdentifier,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
context: {
|
|
81
|
+
credsPayload,
|
|
82
|
+
apiVersion,
|
|
83
|
+
resultPath: 'data.metafieldDefinition',
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const funcApiConfig = {
|
|
89
|
+
argsWarden,
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
module.exports = {
|
|
93
|
+
shopifyMetafieldDefinitionGet,
|
|
94
|
+
funcApiConfig,
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/*
|
|
98
|
+
curl -X POST "http://localhost:8000/shopifyMetafieldDefinitionGet" \
|
|
99
|
+
-H "Content-Type: application/json" \
|
|
100
|
+
-d '{
|
|
101
|
+
"credsPayload": { "credsPath": "shopify.au" },
|
|
102
|
+
"metafieldDefinitionIdentifier": {
|
|
103
|
+
"ownerType": "PRODUCT",
|
|
104
|
+
"namespace": "custom",
|
|
105
|
+
"key": "outfit_builder_image"
|
|
106
|
+
}
|
|
107
|
+
}'
|
|
108
|
+
*/
|
|
@@ -2,36 +2,9 @@
|
|
|
2
2
|
// https://shopify.dev/docs/api/admin-graphql/latest/queries/metafieldDefinition
|
|
3
3
|
|
|
4
4
|
const { credsValidator } = require('../validators');
|
|
5
|
-
const { ArgsWarden,
|
|
6
|
-
const {
|
|
7
|
-
const {
|
|
8
|
-
|
|
9
|
-
const sourceMetafieldDefinitionAttrs = `
|
|
10
|
-
name
|
|
11
|
-
namespace
|
|
12
|
-
key
|
|
13
|
-
description
|
|
14
|
-
ownerType
|
|
15
|
-
pinnedPosition
|
|
16
|
-
type {
|
|
17
|
-
name
|
|
18
|
-
}
|
|
19
|
-
validations {
|
|
20
|
-
name
|
|
21
|
-
value
|
|
22
|
-
}
|
|
23
|
-
capabilities {
|
|
24
|
-
adminFilterable {
|
|
25
|
-
enabled
|
|
26
|
-
}
|
|
27
|
-
smartCollectionCondition {
|
|
28
|
-
enabled
|
|
29
|
-
}
|
|
30
|
-
uniqueValues {
|
|
31
|
-
enabled
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
`.trim();
|
|
5
|
+
const { ArgsWarden, objHasAny } = require('../utils');
|
|
6
|
+
const { shopifyMetafieldDefinitionGet } = require('./shopifyMetafieldDefinitionGet');
|
|
7
|
+
const { shopifyMetafieldDefinitionCreate } = require('./shopifyMetafieldDefinitionCreate');
|
|
35
8
|
|
|
36
9
|
const defaultReturnCreatedDefinitionAttrs = 'id name namespace key ownerType type { name }';
|
|
37
10
|
|
|
@@ -96,37 +69,6 @@ const metafieldDefinitionInputFromDefinition = (sourceDefinition) => {
|
|
|
96
69
|
return definitionInput;
|
|
97
70
|
};
|
|
98
71
|
|
|
99
|
-
const fetchSourceMetafieldDefinition = async (
|
|
100
|
-
fromStoreCredsPayload,
|
|
101
|
-
metafieldDefinitionIdentifier,
|
|
102
|
-
{
|
|
103
|
-
apiVersion,
|
|
104
|
-
} = {},
|
|
105
|
-
) => {
|
|
106
|
-
const creds = await credsFromPayload(fromStoreCredsPayload);
|
|
107
|
-
|
|
108
|
-
return shopifyClient.fetch({
|
|
109
|
-
method: 'post',
|
|
110
|
-
body: {
|
|
111
|
-
query: `
|
|
112
|
-
query GetMetafieldDefinition($identifier: MetafieldDefinitionIdentifierInput!) {
|
|
113
|
-
metafieldDefinition(identifier: $identifier) {
|
|
114
|
-
${ sourceMetafieldDefinitionAttrs }
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
`,
|
|
118
|
-
variables: {
|
|
119
|
-
identifier: metafieldDefinitionIdentifier,
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
context: {
|
|
123
|
-
creds,
|
|
124
|
-
apiVersion,
|
|
125
|
-
resultPath: 'data.metafieldDefinition',
|
|
126
|
-
},
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
|
|
130
72
|
const shopifyMetafieldDefinitionPropagate = async (
|
|
131
73
|
fromStoreCredsPayload,
|
|
132
74
|
toStoreCredsPayload,
|
|
@@ -146,7 +88,7 @@ const shopifyMetafieldDefinitionPropagate = async (
|
|
|
146
88
|
return rejectResponse;
|
|
147
89
|
}
|
|
148
90
|
|
|
149
|
-
const sourceResponse = await
|
|
91
|
+
const sourceResponse = await shopifyMetafieldDefinitionGet(
|
|
150
92
|
fromStoreCredsPayload,
|
|
151
93
|
metafieldDefinitionIdentifier,
|
|
152
94
|
{ apiVersion },
|
|
@@ -169,20 +111,34 @@ const shopifyMetafieldDefinitionPropagate = async (
|
|
|
169
111
|
|
|
170
112
|
const definitionInput = metafieldDefinitionInputFromDefinition(sourceResponse.data);
|
|
171
113
|
|
|
172
|
-
|
|
114
|
+
const {
|
|
115
|
+
ownerType,
|
|
116
|
+
namespace,
|
|
117
|
+
key,
|
|
118
|
+
name,
|
|
119
|
+
type,
|
|
120
|
+
description,
|
|
121
|
+
pin,
|
|
122
|
+
validations,
|
|
123
|
+
capabilities,
|
|
124
|
+
} = definitionInput;
|
|
125
|
+
|
|
126
|
+
return shopifyMetafieldDefinitionCreate(
|
|
173
127
|
toStoreCredsPayload,
|
|
174
|
-
|
|
128
|
+
ownerType,
|
|
129
|
+
namespace,
|
|
130
|
+
key,
|
|
131
|
+
name,
|
|
132
|
+
type,
|
|
175
133
|
{
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
},
|
|
134
|
+
apiVersion,
|
|
135
|
+
...(description && { description }),
|
|
136
|
+
...(pin != null && { pin }),
|
|
137
|
+
...(validations && { validations }),
|
|
138
|
+
...(capabilities && { capabilities }),
|
|
182
139
|
returnSchema: `
|
|
183
140
|
createdDefinition { ${ returnCreatedDefinitionAttrs } }
|
|
184
141
|
`.trim(),
|
|
185
|
-
apiVersion,
|
|
186
142
|
},
|
|
187
143
|
);
|
|
188
144
|
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// https://shopify.dev/docs/api/admin-graphql/latest/queries/theme
|
|
2
|
+
|
|
3
|
+
const { credsValidator } = require('../validators');
|
|
4
|
+
const { ArgsWarden, ensureArray } = require('../utils');
|
|
5
|
+
const { shopifyClient } = require('./shopify.utils');
|
|
6
|
+
|
|
7
|
+
const defaultAttrs = `
|
|
8
|
+
filename
|
|
9
|
+
contentType
|
|
10
|
+
size
|
|
11
|
+
body {
|
|
12
|
+
... on OnlineStoreThemeFileBodyText {
|
|
13
|
+
content
|
|
14
|
+
}
|
|
15
|
+
... on OnlineStoreThemeFileBodyBase64 {
|
|
16
|
+
contentBase64
|
|
17
|
+
}
|
|
18
|
+
... on OnlineStoreThemeFileBodyUrl {
|
|
19
|
+
url
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`.trim();
|
|
23
|
+
|
|
24
|
+
const argsWarden = new ArgsWarden([
|
|
25
|
+
['credsPayload', credsValidator],
|
|
26
|
+
['themeId'],
|
|
27
|
+
['filenames'],
|
|
28
|
+
]);
|
|
29
|
+
|
|
30
|
+
const shopifyThemeFileGet = async (
|
|
31
|
+
credsPayload,
|
|
32
|
+
themeId,
|
|
33
|
+
filenames,
|
|
34
|
+
{
|
|
35
|
+
apiVersion,
|
|
36
|
+
attrs = defaultAttrs,
|
|
37
|
+
} = {},
|
|
38
|
+
) => {
|
|
39
|
+
|
|
40
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
41
|
+
credsPayload,
|
|
42
|
+
themeId,
|
|
43
|
+
filenames,
|
|
44
|
+
});
|
|
45
|
+
if (rejectResponse) {
|
|
46
|
+
return rejectResponse;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const filenamesList = ensureArray(filenames);
|
|
50
|
+
|
|
51
|
+
const response = await shopifyClient.fetch({
|
|
52
|
+
requestPayload: {
|
|
53
|
+
method: 'post',
|
|
54
|
+
body: {
|
|
55
|
+
query: `
|
|
56
|
+
query ThemeFiles($themeId: ID!, $filenames: [String!]!) {
|
|
57
|
+
theme(id: $themeId) {
|
|
58
|
+
files(filenames: $filenames) {
|
|
59
|
+
nodes {
|
|
60
|
+
${ attrs }
|
|
61
|
+
}
|
|
62
|
+
userErrors {
|
|
63
|
+
code
|
|
64
|
+
filename
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
`,
|
|
70
|
+
variables: {
|
|
71
|
+
themeId: `gid://shopify/OnlineStoreTheme/${ themeId }`,
|
|
72
|
+
filenames: filenamesList,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
context: {
|
|
77
|
+
credsPayload,
|
|
78
|
+
apiVersion,
|
|
79
|
+
resultPath: 'data.theme.files',
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
if (!response.ok) {
|
|
84
|
+
return response;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// stripEdgesAndNodes turns files.nodes into an array (userErrors on the
|
|
88
|
+
// connection are dropped by the shared Shopify client pipeline).
|
|
89
|
+
return {
|
|
90
|
+
ok: true,
|
|
91
|
+
data: ensureArray(response.data),
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const funcApiConfig = {
|
|
96
|
+
argsWarden,
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
module.exports = {
|
|
100
|
+
shopifyThemeFileGet,
|
|
101
|
+
funcApiConfig,
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/*
|
|
105
|
+
curl -X POST "http://localhost:8000/shopifyThemeFileGet" \
|
|
106
|
+
-H "Content-Type: application/json" \
|
|
107
|
+
-d '{
|
|
108
|
+
"credsPayload": { "credsPath": "shopify.au" },
|
|
109
|
+
"themeId": "129840808008",
|
|
110
|
+
"filenames": "templates/page.sign_up_beauty.json"
|
|
111
|
+
}'
|
|
112
|
+
*/
|