@emulates/easypost 0.0.0-stage → 3.0.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/dist/server.js ADDED
@@ -0,0 +1,12 @@
1
+ import {
2
+ DEFAULT_PORT,
3
+ createServer,
4
+ serveTarget
5
+ } from "./chunk-X5XEHMAK.js";
6
+ import "./chunk-7GJN6ROH.js";
7
+ export {
8
+ DEFAULT_PORT,
9
+ createServer,
10
+ serveTarget
11
+ };
12
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
package/openapi.yaml ADDED
@@ -0,0 +1,286 @@
1
+ openapi: 3.1.0
2
+ info:
3
+ title: EasyPost Trackers API (Emulates subset)
4
+ description: |
5
+ Stateful mock subset of the EasyPost v2 API: create (or re-use) a tracker for a tracking
6
+ code, retrieve it, and list trackers. Trimmed from EasyPost's published reference to what
7
+ our genomics tracking lookup calls, plus the two reads that make parity walks meaningful.
8
+ version: "2"
9
+ x-emulates-upstream:
10
+ note: >-
11
+ Shapes from https://docs.easypost.com/docs/trackers; request/response fields our consumer
12
+ reads come from packages/lib/src/shipment-tracking-status/easypost-client.ts.
13
+ servers:
14
+ - url: https://api.easypost.com
15
+ security:
16
+ - basicAuth: []
17
+ paths:
18
+ /v2/trackers:
19
+ post:
20
+ operationId: CreateTracker
21
+ description: >-
22
+ Creates a tracker, or answers the existing one when the same tracking code (and
23
+ carrier) was already tracked. EasyPost's test codes (EZ1000000001 … EZ7000000007)
24
+ answer their documented fixed statuses.
25
+ x-emulates:
26
+ supported: true
27
+ parity:
28
+ enabled: true
29
+ safe: true
30
+ requestBody:
31
+ required: true
32
+ content:
33
+ application/x-www-form-urlencoded:
34
+ schema:
35
+ $ref: "#/components/schemas/CreateTrackerBody"
36
+ application/json:
37
+ schema:
38
+ $ref: "#/components/schemas/CreateTrackerBody"
39
+ responses:
40
+ "201":
41
+ description: The tracker (new or re-used)
42
+ content:
43
+ application/json:
44
+ schema:
45
+ $ref: "#/components/schemas/Tracker"
46
+ "401":
47
+ description: Missing or unknown API key
48
+ content:
49
+ application/json:
50
+ schema:
51
+ $ref: "#/components/schemas/Error"
52
+ "422":
53
+ description: Missing tracking code or invalid carrier
54
+ content:
55
+ application/json:
56
+ schema:
57
+ $ref: "#/components/schemas/Error"
58
+ get:
59
+ operationId: ListTrackers
60
+ x-emulates:
61
+ supported: true
62
+ parity:
63
+ enabled: true
64
+ safe: true
65
+ parameters:
66
+ - name: tracking_code
67
+ in: query
68
+ required: false
69
+ schema:
70
+ type: string
71
+ maxLength: 40
72
+ - name: carrier
73
+ in: query
74
+ required: false
75
+ schema:
76
+ type: string
77
+ enum: [USPS, UPS, FedEx, DHLExpress]
78
+ - name: page_size
79
+ in: query
80
+ required: false
81
+ schema:
82
+ type: integer
83
+ minimum: 1
84
+ maximum: 100
85
+ responses:
86
+ "200":
87
+ description: Newest trackers first
88
+ content:
89
+ application/json:
90
+ schema:
91
+ type: object
92
+ required: [trackers, has_more]
93
+ properties:
94
+ trackers:
95
+ type: array
96
+ items:
97
+ $ref: "#/components/schemas/Tracker"
98
+ has_more:
99
+ type: boolean
100
+ "401":
101
+ description: Missing or unknown API key
102
+ content:
103
+ application/json:
104
+ schema:
105
+ $ref: "#/components/schemas/Error"
106
+ "422":
107
+ description: Invalid query parameter
108
+ content:
109
+ application/json:
110
+ schema:
111
+ $ref: "#/components/schemas/Error"
112
+ /v2/trackers/{id}:
113
+ parameters:
114
+ - name: id
115
+ in: path
116
+ required: true
117
+ schema:
118
+ type: string
119
+ x-emulates-resource-ref:
120
+ type: tracker
121
+ missing: trk_00000000000000000000000000000000
122
+ get:
123
+ operationId: RetrieveTracker
124
+ x-emulates:
125
+ supported: true
126
+ parity:
127
+ enabled: true
128
+ safe: true
129
+ responses:
130
+ "200":
131
+ description: The tracker
132
+ content:
133
+ application/json:
134
+ schema:
135
+ $ref: "#/components/schemas/Tracker"
136
+ "401":
137
+ description: Missing or unknown API key
138
+ content:
139
+ application/json:
140
+ schema:
141
+ $ref: "#/components/schemas/Error"
142
+ "404":
143
+ description: Unknown tracker
144
+ content:
145
+ application/json:
146
+ schema:
147
+ $ref: "#/components/schemas/Error"
148
+ components:
149
+ securitySchemes:
150
+ basicAuth:
151
+ type: http
152
+ scheme: basic
153
+ description: "The API key as the username, an empty password (`Basic base64(key:)`)."
154
+ schemas:
155
+ CreateTrackerBody:
156
+ type: object
157
+ required: [tracker]
158
+ properties:
159
+ tracker:
160
+ type: object
161
+ required: [tracking_code]
162
+ properties:
163
+ tracking_code:
164
+ type: string
165
+ minLength: 1
166
+ maxLength: 40
167
+ examples: [EZ1000000001, EZ4000000004, 1Z999AA10123456784]
168
+ carrier:
169
+ type: string
170
+ enum: [USPS, UPS, FedEx, DHL, DHLExpress]
171
+ Tracker:
172
+ type: object
173
+ required:
174
+ - id
175
+ - object
176
+ - mode
177
+ - tracking_code
178
+ - status
179
+ - status_detail
180
+ - carrier
181
+ - tracking_details
182
+ - public_url
183
+ - created_at
184
+ - updated_at
185
+ properties:
186
+ id:
187
+ type: string
188
+ x-emulates-resource:
189
+ type: tracker
190
+ identity: true
191
+ x-emulates-volatile:
192
+ kind: id
193
+ object:
194
+ type: string
195
+ enum: [Tracker]
196
+ mode:
197
+ type: string
198
+ enum: [test, production]
199
+ tracking_code:
200
+ type: string
201
+ status:
202
+ type: string
203
+ enum:
204
+ - unknown
205
+ - pre_transit
206
+ - in_transit
207
+ - out_for_delivery
208
+ - delivered
209
+ - available_for_pickup
210
+ - return_to_sender
211
+ - failure
212
+ - cancelled
213
+ - error
214
+ status_detail:
215
+ type: string
216
+ carrier:
217
+ type: string
218
+ signed_by:
219
+ type: ["string", "null"]
220
+ weight:
221
+ type: ["number", "null"]
222
+ est_delivery_date:
223
+ type: ["string", "null"]
224
+ x-emulates-volatile:
225
+ kind: timestamp
226
+ shipment_id:
227
+ type: ["string", "null"]
228
+ tracking_details:
229
+ type: array
230
+ items:
231
+ $ref: "#/components/schemas/TrackingDetail"
232
+ carrier_detail:
233
+ type: ["object", "null"]
234
+ public_url:
235
+ type: string
236
+ x-emulates-volatile:
237
+ kind: url
238
+ fees:
239
+ type: array
240
+ items:
241
+ type: object
242
+ created_at:
243
+ type: string
244
+ x-emulates-volatile:
245
+ kind: timestamp
246
+ updated_at:
247
+ type: string
248
+ x-emulates-volatile:
249
+ kind: timestamp
250
+ TrackingDetail:
251
+ type: object
252
+ required: [object, message, status, status_detail, datetime, source]
253
+ properties:
254
+ object:
255
+ type: string
256
+ enum: [TrackingDetail]
257
+ message:
258
+ type: string
259
+ status:
260
+ type: string
261
+ status_detail:
262
+ type: string
263
+ datetime:
264
+ type: string
265
+ x-emulates-volatile:
266
+ kind: timestamp
267
+ source:
268
+ type: string
269
+ tracking_location:
270
+ type: object
271
+ Error:
272
+ type: object
273
+ required: [error]
274
+ properties:
275
+ error:
276
+ type: object
277
+ required: [code, message]
278
+ properties:
279
+ code:
280
+ type: string
281
+ message:
282
+ type: string
283
+ errors:
284
+ type: array
285
+ items:
286
+ type: object
package/package.json CHANGED
@@ -1,6 +1,117 @@
1
1
  {
2
2
  "name": "@emulates/easypost",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "3.0.0",
4
+ "description": "Stateful emulator of the EasyPost trackers API: create/re-use trackers, EasyPost's test tracking codes, admin status transitions and EasyPost's error envelope.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "files": [
9
+ "dist",
10
+ "README.md",
11
+ "CHANGELOG.md",
12
+ "DISCOVERY.md",
13
+ "SUPPORT.md",
14
+ "openapi.yaml"
15
+ ],
16
+ "main": "./dist/index.js",
17
+ "types": "./dist/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "default": "./dist/index.js"
22
+ },
23
+ "./server": {
24
+ "types": "./dist/server.d.ts",
25
+ "default": "./dist/server.js"
26
+ }
27
+ },
28
+ "bin": {
29
+ "emulates-easypost": "./dist/cli.js"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public",
33
+ "provenance": true
34
+ },
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/crvouga/emulates.git",
38
+ "directory": "packages/service/easypost"
39
+ },
40
+ "homepage": "https://github.com/crvouga/emulates/tree/main/packages/service/easypost#readme",
41
+ "keywords": [
42
+ "emulates",
43
+ "service",
44
+ "easypost",
45
+ "shipping",
46
+ "tracking"
47
+ ],
48
+ "emulates": {
49
+ "runtime": "portable",
50
+ "entries": {
51
+ "server": "node",
52
+ "cli": "node"
53
+ },
54
+ "layer": "service",
55
+ "category": "logistics",
56
+ "displayName": "EasyPost",
57
+ "vendor": {
58
+ "website": "https://www.easypost.com",
59
+ "docs": "https://docs.easypost.com/docs/trackers"
60
+ },
61
+ "parity": "Trackers",
62
+ "parityTier": "cold",
63
+ "discovery": {
64
+ "guide": "DISCOVERY.md",
65
+ "behavior": "README.md",
66
+ "capabilities": "SUPPORT.md",
67
+ "contract": "openapi.yaml",
68
+ "types": "dist/index.d.ts",
69
+ "oracle": {
70
+ "kind": "Live vendor API or sandbox",
71
+ "command": "bun run parity:service -- easypost",
72
+ "note": "Run from an Emulates checkout; credentials come only from .env.local or GitHub Actions secrets. Missing credentials exit 2."
73
+ },
74
+ "introspection": [
75
+ "GET /__admin/health",
76
+ "GET /__admin",
77
+ "GET /__admin/state",
78
+ "GET /__admin/requests",
79
+ "GET /__admin/metrics",
80
+ "GET /__admin/faults/presets",
81
+ "GET /__admin/ui"
82
+ ],
83
+ "reporting": "https://github.com/crvouga/emulates/blob/main/docs/REPORTING_ISSUES.md"
84
+ }
85
+ },
86
+ "scripts": {
87
+ "generate": "bun ../../openapi/codegen/dist/cli.js",
88
+ "generate:check": "bun ../../openapi/codegen/dist/cli.js --check",
89
+ "openapi:check": "bun ../../openapi/codegen/dist/cli.js --validate",
90
+ "build": "bun ../../../scripts/bundle-service.ts",
91
+ "typecheck": "tsc -p tsconfig.json --noEmit",
92
+ "lint": "biome check .",
93
+ "test": "bun test",
94
+ "parity": "bun scripts/parity.ts",
95
+ "portability": "bun ../../../scripts/portability.ts",
96
+ "pack:check": "bun ../../../scripts/pack-check.ts"
97
+ },
98
+ "dependencies": {
99
+ "@emulates/sqlite": "3.0.0",
100
+ "hono": "4.11.9"
101
+ },
102
+ "devDependencies": {
103
+ "fast-check": "4.9.0",
104
+ "@emulates/testing": "0.1.0",
105
+ "@emulates/sqlite": "0.0.0-development",
106
+ "@emulates/parity": "0.0.0-development",
107
+ "@emulates/credentials": "0.0.0-development",
108
+ "@emulates/openapi-codegen": "0.1.0",
109
+ "@emulates/openapi-metadata": "0.0.0-development",
110
+ "@emulates/core": "0.0.0-development",
111
+ "@emulates/sqlite-client": "0.0.0-development",
112
+ "@emulates/openapi": "0.0.0-development",
113
+ "@emulates/service": "0.0.0-development",
114
+ "@emulates/http-codec": "0.0.0-development",
115
+ "@emulates/adapter-node": "0.0.0-development"
116
+ }
117
+ }