@pintahub/database-schemas 5.7.1 → 5.8.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.
- package/README.md +1 -1
- package/package.json +1 -1
- package/schemas/ShopifyAPIRequest.js +79 -0
package/README.md
CHANGED
|
@@ -103,7 +103,7 @@ StoreEvent, LatestEvent, RecentView, SearchTerm, FavoriteItem, TrackPage, Market
|
|
|
103
103
|
ShortUrl, ShortDomain, ShortLog, LogURL
|
|
104
104
|
|
|
105
105
|
### Jobs & Events
|
|
106
|
-
ExportJob, TransferJob, WebhookEvent
|
|
106
|
+
ExportJob, TransferJob, WebhookEvent, ShopifyAPIRequest
|
|
107
107
|
|
|
108
108
|
### Settings & Config
|
|
109
109
|
StoreSetting, BlockedLocation, Publication, ShopifyObject
|
package/package.json
CHANGED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
const {Schema} = require('mongoose')
|
|
2
|
+
|
|
3
|
+
/** Outbound Shopify GraphQL Admin API request log — paired with WebhookEvent (which captures inbound). TTL: 3 hours. */
|
|
4
|
+
const ShopifyAPIRequest = new Schema({
|
|
5
|
+
/** @ref Store */
|
|
6
|
+
store: {
|
|
7
|
+
type: Schema.Types.ObjectId,
|
|
8
|
+
ref: 'Store',
|
|
9
|
+
index: true,
|
|
10
|
+
required: true,
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
/** Shopify API version, e.g. '2025-01' */
|
|
14
|
+
api_version: {
|
|
15
|
+
type: String,
|
|
16
|
+
trim: true,
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
/** GraphQL operation name */
|
|
20
|
+
graphql_operation_name: {
|
|
21
|
+
type: String,
|
|
22
|
+
trim: true,
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
/** HTTP response status code */
|
|
26
|
+
response_status: {
|
|
27
|
+
type: Number,
|
|
28
|
+
index: true,
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
/** Wall-clock request latency in milliseconds */
|
|
32
|
+
duration_ms: {
|
|
33
|
+
type: Number,
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
/** Rate-limit / throttle signals from Shopify GraphQL */
|
|
37
|
+
rate_limit: {
|
|
38
|
+
/** extensions.cost.actualQueryCost */
|
|
39
|
+
actual_cost: {type: Number},
|
|
40
|
+
|
|
41
|
+
/** extensions.cost.requestedQueryCost */
|
|
42
|
+
requested_cost: {type: Number},
|
|
43
|
+
|
|
44
|
+
/** extensions.cost.throttleStatus.currentlyAvailable */
|
|
45
|
+
throttle_available: {type: Number},
|
|
46
|
+
|
|
47
|
+
/** extensions.cost.throttleStatus.maximumAvailable */
|
|
48
|
+
throttle_max: {type: Number},
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Request outcome:
|
|
53
|
+
* - success: non-error response (2xx, no GraphQL errors)
|
|
54
|
+
* - failed: network error, non-2xx, or GraphQL errors present
|
|
55
|
+
*/
|
|
56
|
+
status: {
|
|
57
|
+
type: String,
|
|
58
|
+
enum: ['success', 'failed'],
|
|
59
|
+
default: 'success',
|
|
60
|
+
index: true,
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
/** Error message when status='failed' */
|
|
64
|
+
error_message: {
|
|
65
|
+
type: String,
|
|
66
|
+
trim: true,
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
/** TTL: auto-expires after 3 hours */
|
|
70
|
+
created_at: {
|
|
71
|
+
type: Date,
|
|
72
|
+
default: Date.now,
|
|
73
|
+
expires: 3_600 * 3,
|
|
74
|
+
},
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
ShopifyAPIRequest.index({store: 1, status: 1, created_at: -1})
|
|
78
|
+
|
|
79
|
+
module.exports = ShopifyAPIRequest
|