@primitivedotdev/sdk 1.3.0 → 1.5.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 +44 -0
- package/dist/api/index.d.ts +4 -4
- package/dist/api/index.js +3 -3
- package/dist/{api-DacG4JSU.js → api-DrrmrNDe.js} +257 -22
- package/dist/contract/index.d.ts +2 -2
- package/dist/contract/index.js +1 -1
- package/dist/{errors-7E9sW9eX.d.ts → errors-DyuAXctD.d.ts} +1 -1
- package/dist/{index-X7RsDaVi.d.ts → index--2RzTxVl.d.ts} +361 -7
- package/dist/{index-DR978rq5.d.ts → index-iZWfb98V.d.ts} +275 -4
- package/dist/index.d.ts +6 -184
- package/dist/index.js +4 -194
- package/dist/openapi/index.js +1 -1
- package/dist/{operations.generated-DSMTMcWh.js → operations.generated-CA3-eorF.js} +453 -3
- package/dist/parser/index.d.ts +1 -1
- package/dist/{types-yNU-Oiea.d.ts → types-QT2ss9ho.d.ts} +207 -3
- package/dist/webhook/index.d.ts +4 -4
- package/dist/webhook/index.js +1 -1
- package/dist/{webhook-BAwK8EOG.js → webhook-CwjCyFv-.js} +2559 -224
- package/dist/x402/index.d.ts +263 -0
- package/dist/x402/index.js +320 -0
- package/package.json +6 -1
|
@@ -79,7 +79,7 @@ const openapiDocument = {
|
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
"name": "Functions",
|
|
82
|
-
"description": "Deploy JavaScript handlers that run on inbound mail. Each function\nis a single ESM module whose default export is an object with an\nasync `fetch(request, env)` method, in the shape of a Workers-style\nhandler. Primitive signs each delivery and forwards the\n`Primitive-Signature` header to the handler; verify the raw request\nbody with `PRIMITIVE_WEBHOOK_SECRET` before trusting the parsed
|
|
82
|
+
"description": "Deploy JavaScript handlers that run on inbound mail. Each function\nis a single ESM module whose default export is an object with an\nasync `fetch(request, env)` method, in the shape of a Workers-style\nhandler. Primitive signs each delivery and forwards the\n`Primitive-Signature` header to the handler; verify the raw request\nbody with `PRIMITIVE_WEBHOOK_SECRET` before trusting the parsed event.\nThe `event` field is `email.received` for normal inbound mail, or a\nmachine-mail type (`email.bounced`, `email.tls_report`,\n`email.dmarc_report`, `email.dmarc_failure`) for bounces and reports;\nthe payload shape is otherwise identical. Code runs on\nPrimitive's edge runtime; there is no infrastructure to manage.\nSecrets land in `env` as encrypted bindings and are refreshed on\nevery redeploy.\n"
|
|
83
83
|
}
|
|
84
84
|
],
|
|
85
85
|
"paths": {
|
|
@@ -851,6 +851,25 @@ const openapiDocument = {
|
|
|
851
851
|
"format": "date-time"
|
|
852
852
|
},
|
|
853
853
|
"description": "Filter emails created on or before this timestamp"
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
"name": "since",
|
|
857
|
+
"in": "query",
|
|
858
|
+
"schema": {
|
|
859
|
+
"type": "string",
|
|
860
|
+
"maxLength": 200
|
|
861
|
+
},
|
|
862
|
+
"description": "Forward-tail cursor. Returns rows that became visible AFTER this\ncursor, oldest-first, so a caller can stream new inbound mail by\nre-passing the cursor from each response. Mutually exclusive with\n`cursor` (which pages history newest-first). Pass the `meta.cursor`\nfrom the previous `since` response; an empty page means caught up.\n"
|
|
863
|
+
},
|
|
864
|
+
{
|
|
865
|
+
"name": "wait",
|
|
866
|
+
"in": "query",
|
|
867
|
+
"schema": {
|
|
868
|
+
"type": "integer",
|
|
869
|
+
"minimum": 0,
|
|
870
|
+
"maximum": 30
|
|
871
|
+
},
|
|
872
|
+
"description": "Long-poll: hold the request up to this many seconds waiting for new\nmail past `since`, returning as soon as any arrives (or an empty\npage when the wait elapses). Requires `since`. Omitted means no wait\n(returns immediately); the server treats an absent value as 0. NOT\ngiven an OpenAPI `default` on purpose: a default makes some\ngenerators (e.g. openapi-python-client) send `wait=0` on every call,\nwhich then fails the `wait` requires `since` check for plain history\nlistings.\n"
|
|
854
873
|
}
|
|
855
874
|
],
|
|
856
875
|
"responses": {
|
|
@@ -1790,7 +1809,7 @@ const openapiDocument = {
|
|
|
1790
1809
|
"post": {
|
|
1791
1810
|
"operationId": "createFunction",
|
|
1792
1811
|
"summary": "Deploy a function",
|
|
1793
|
-
"description": "Creates and deploys a new function. The handler must be a single\nESM module whose default export is an object with an async\n`fetch(request, env)` method (Workers-style). Primitive signs\neach delivery and forwards the `Primitive-Signature` header to\nthe handler. Verify the raw request body with\n`PRIMITIVE_WEBHOOK_SECRET` before parsing JSON; after verification\nthe request body parses to
|
|
1812
|
+
"description": "Creates and deploys a new function. The handler must be a single\nESM module whose default export is an object with an async\n`fetch(request, env)` method (Workers-style). Primitive signs\neach delivery and forwards the `Primitive-Signature` header to\nthe handler. Verify the raw request body with\n`PRIMITIVE_WEBHOOK_SECRET` before parsing JSON; after verification\nthe request body parses to a webhook event whose `event` field is\n`email.received` for normal inbound mail, or a machine-mail type\n(`email.bounced`, `email.tls_report`, `email.dmarc_report`,\n`email.dmarc_failure`) for bounces and reports. Code is bundled\nbefore being uploaded; ship a single self-contained file rather\nthan relying on external imports.\n\n**Code limits.** `code` is capped at 1 MiB UTF-8. `sourceMap`\n(optional) is capped at 5 MiB UTF-8, stored with each deployment\nattempt, and sent to the runtime so stack traces can resolve to\noriginal source files.\n\n**Routing.** On successful deploy, the function code is live\nin the runtime, but inbound mail will not reach it until at\nleast one route is bound. Routes are managed from the Primitive\ndashboard. A `deploy_status` of `deployed` means the script is\ninstalled, not that the function is receiving mail. The\ninternal runtime URL is not returned by the API and is not a\ncustomer-facing integration surface.\n\n**Secrets.** New functions ship with the managed secrets\n(`PRIMITIVE_WEBHOOK_SECRET`, `PRIMITIVE_API_KEY`,\n`PRIMITIVE_API_BASE_URL`) already bound. Add user-set secrets via\n`POST /functions/{id}/secrets`; secret writes only land in the\nrunning handler on the next redeploy.\n",
|
|
1794
1813
|
"tags": ["Functions"],
|
|
1795
1814
|
"requestBody": {
|
|
1796
1815
|
"required": true,
|
|
@@ -2149,6 +2168,111 @@ const openapiDocument = {
|
|
|
2149
2168
|
}
|
|
2150
2169
|
}
|
|
2151
2170
|
},
|
|
2171
|
+
"/org/secrets": {
|
|
2172
|
+
"get": {
|
|
2173
|
+
"operationId": "listOrgSecrets",
|
|
2174
|
+
"summary": "List org-level (global) secrets",
|
|
2175
|
+
"description": "Returns metadata for every org-level secret. Org secrets apply\nto every function in the org and are read as `env.<KEY>` in\nhandlers. **Values are never returned.** Secret writes are\nwrite-only. A function-level secret of the same name overrides\nthe org-level value for that function.\n",
|
|
2176
|
+
"tags": ["Functions"],
|
|
2177
|
+
"responses": {
|
|
2178
|
+
"200": {
|
|
2179
|
+
"description": "List of org secrets (metadata only, no values)",
|
|
2180
|
+
"content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, {
|
|
2181
|
+
"type": "object",
|
|
2182
|
+
"properties": { "data": {
|
|
2183
|
+
"type": "object",
|
|
2184
|
+
"properties": { "items": {
|
|
2185
|
+
"type": "array",
|
|
2186
|
+
"items": { "$ref": "#/components/schemas/OrgSecretListItem" }
|
|
2187
|
+
} },
|
|
2188
|
+
"required": ["items"]
|
|
2189
|
+
} }
|
|
2190
|
+
}] } } }
|
|
2191
|
+
},
|
|
2192
|
+
"401": { "$ref": "#/components/responses/Unauthorized" }
|
|
2193
|
+
}
|
|
2194
|
+
},
|
|
2195
|
+
"post": {
|
|
2196
|
+
"operationId": "createOrgSecret",
|
|
2197
|
+
"summary": "Create or update an org secret",
|
|
2198
|
+
"description": "Idempotent insert-or-update keyed on `(org_id, key)`. Returns\n201 the first time the key is set, 200 on subsequent updates.\nValues are encrypted at rest. A changed value lands in a\nfunction only on that function's next deploy.\n\nKeys must match `^[A-Z_][A-Z0-9_]*$` (uppercase letters,\ndigits, underscores; first character is a letter or\nunderscore). Values are at most 4096 UTF-8 bytes. System-\nmanaged keys are reserved and rejected.\n",
|
|
2199
|
+
"tags": ["Functions"],
|
|
2200
|
+
"requestBody": {
|
|
2201
|
+
"required": true,
|
|
2202
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateOrgSecretInput" } } }
|
|
2203
|
+
},
|
|
2204
|
+
"responses": {
|
|
2205
|
+
"200": {
|
|
2206
|
+
"description": "Secret updated",
|
|
2207
|
+
"content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, {
|
|
2208
|
+
"type": "object",
|
|
2209
|
+
"properties": { "data": { "$ref": "#/components/schemas/OrgSecretWriteResult" } }
|
|
2210
|
+
}] } } }
|
|
2211
|
+
},
|
|
2212
|
+
"201": {
|
|
2213
|
+
"description": "Secret created",
|
|
2214
|
+
"content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, {
|
|
2215
|
+
"type": "object",
|
|
2216
|
+
"properties": { "data": { "$ref": "#/components/schemas/OrgSecretWriteResult" } }
|
|
2217
|
+
}] } } }
|
|
2218
|
+
},
|
|
2219
|
+
"400": { "$ref": "#/components/responses/ValidationError" },
|
|
2220
|
+
"401": { "$ref": "#/components/responses/Unauthorized" }
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
},
|
|
2224
|
+
"/org/secrets/{key}": {
|
|
2225
|
+
"parameters": [{
|
|
2226
|
+
"name": "key",
|
|
2227
|
+
"in": "path",
|
|
2228
|
+
"required": true,
|
|
2229
|
+
"description": "Secret key. Must match `^[A-Z_][A-Z0-9_]*$`.",
|
|
2230
|
+
"schema": {
|
|
2231
|
+
"type": "string",
|
|
2232
|
+
"pattern": "^[A-Z_][A-Z0-9_]*$"
|
|
2233
|
+
}
|
|
2234
|
+
}],
|
|
2235
|
+
"put": {
|
|
2236
|
+
"operationId": "setOrgSecret",
|
|
2237
|
+
"summary": "Set an org secret by key",
|
|
2238
|
+
"description": "Path-keyed companion to `POST /org/secrets`. Idempotent:\nreturns 201 the first time the key is set, 200 on subsequent\nupdates. Same validation and write-only guarantees as POST.\n",
|
|
2239
|
+
"tags": ["Functions"],
|
|
2240
|
+
"requestBody": {
|
|
2241
|
+
"required": true,
|
|
2242
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/SetOrgSecretInput" } } }
|
|
2243
|
+
},
|
|
2244
|
+
"responses": {
|
|
2245
|
+
"200": {
|
|
2246
|
+
"description": "Secret updated",
|
|
2247
|
+
"content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, {
|
|
2248
|
+
"type": "object",
|
|
2249
|
+
"properties": { "data": { "$ref": "#/components/schemas/OrgSecretWriteResult" } }
|
|
2250
|
+
}] } } }
|
|
2251
|
+
},
|
|
2252
|
+
"201": {
|
|
2253
|
+
"description": "Secret created",
|
|
2254
|
+
"content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, {
|
|
2255
|
+
"type": "object",
|
|
2256
|
+
"properties": { "data": { "$ref": "#/components/schemas/OrgSecretWriteResult" } }
|
|
2257
|
+
}] } } }
|
|
2258
|
+
},
|
|
2259
|
+
"400": { "$ref": "#/components/responses/ValidationError" },
|
|
2260
|
+
"401": { "$ref": "#/components/responses/Unauthorized" }
|
|
2261
|
+
}
|
|
2262
|
+
},
|
|
2263
|
+
"delete": {
|
|
2264
|
+
"operationId": "deleteOrgSecret",
|
|
2265
|
+
"summary": "Delete an org secret",
|
|
2266
|
+
"description": "Removes the org secret. Functions keep the previous value until\neach is redeployed. Returns 404 if the key did not exist.\n",
|
|
2267
|
+
"tags": ["Functions"],
|
|
2268
|
+
"responses": {
|
|
2269
|
+
"204": { "description": "Secret deleted" },
|
|
2270
|
+
"400": { "$ref": "#/components/responses/ValidationError" },
|
|
2271
|
+
"401": { "$ref": "#/components/responses/Unauthorized" },
|
|
2272
|
+
"404": { "$ref": "#/components/responses/NotFound" }
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
},
|
|
2152
2276
|
"/functions/{id}/logs": {
|
|
2153
2277
|
"parameters": [{ "$ref": "#/components/parameters/ResourceId" }],
|
|
2154
2278
|
"get": {
|
|
@@ -3310,6 +3434,16 @@ const openapiDocument = {
|
|
|
3310
3434
|
},
|
|
3311
3435
|
"email": { "type": "string" },
|
|
3312
3436
|
"plan": { "type": "string" },
|
|
3437
|
+
"limits": { "$ref": "#/components/schemas/PlanLimits" },
|
|
3438
|
+
"entitlements": {
|
|
3439
|
+
"type": "array",
|
|
3440
|
+
"items": { "type": "string" },
|
|
3441
|
+
"description": "Granted org entitlement keys (sorted). A headless caller reads its\ncapabilities here — e.g. an emailless agent seeing only\n[\"send_mail\", \"send_to_known_addresses\"] knows it is reply-only.\n"
|
|
3442
|
+
},
|
|
3443
|
+
"managed_inbox_address": {
|
|
3444
|
+
"type": ["string", "null"],
|
|
3445
|
+
"description": "The managed inbox FQDN to reply as, or null if the org has no managed inbox."
|
|
3446
|
+
},
|
|
3313
3447
|
"created_at": {
|
|
3314
3448
|
"type": "string",
|
|
3315
3449
|
"format": "date-time"
|
|
@@ -3337,6 +3471,9 @@ const openapiDocument = {
|
|
|
3337
3471
|
"id",
|
|
3338
3472
|
"email",
|
|
3339
3473
|
"plan",
|
|
3474
|
+
"limits",
|
|
3475
|
+
"entitlements",
|
|
3476
|
+
"managed_inbox_address",
|
|
3340
3477
|
"created_at",
|
|
3341
3478
|
"discard_content_on_webhook_confirmed"
|
|
3342
3479
|
]
|
|
@@ -6347,6 +6484,81 @@ const openapiDocument = {
|
|
|
6347
6484
|
"updated_at",
|
|
6348
6485
|
"created"
|
|
6349
6486
|
]
|
|
6487
|
+
},
|
|
6488
|
+
"OrgSecretListItem": {
|
|
6489
|
+
"type": "object",
|
|
6490
|
+
"description": "One row from GET /org/secrets. Org secrets are always user-set\n(there are no managed org secrets), so `created_at` /\n`updated_at` are always present.\n",
|
|
6491
|
+
"properties": {
|
|
6492
|
+
"key": { "type": "string" },
|
|
6493
|
+
"created_at": {
|
|
6494
|
+
"type": "string",
|
|
6495
|
+
"format": "date-time"
|
|
6496
|
+
},
|
|
6497
|
+
"updated_at": {
|
|
6498
|
+
"type": "string",
|
|
6499
|
+
"format": "date-time"
|
|
6500
|
+
}
|
|
6501
|
+
},
|
|
6502
|
+
"required": [
|
|
6503
|
+
"key",
|
|
6504
|
+
"created_at",
|
|
6505
|
+
"updated_at"
|
|
6506
|
+
]
|
|
6507
|
+
},
|
|
6508
|
+
"CreateOrgSecretInput": {
|
|
6509
|
+
"type": "object",
|
|
6510
|
+
"additionalProperties": false,
|
|
6511
|
+
"description": "Body for POST /org/secrets.",
|
|
6512
|
+
"properties": {
|
|
6513
|
+
"key": {
|
|
6514
|
+
"type": "string",
|
|
6515
|
+
"pattern": "^[A-Z_][A-Z0-9_]*$",
|
|
6516
|
+
"description": "Uppercase letters, digits, and underscores. Must start with\na letter or underscore. System-managed keys are reserved.\n"
|
|
6517
|
+
},
|
|
6518
|
+
"value": {
|
|
6519
|
+
"type": "string",
|
|
6520
|
+
"minLength": 1,
|
|
6521
|
+
"maxLength": 4096,
|
|
6522
|
+
"description": "Secret value, up to 4096 UTF-8 bytes. Encrypted at rest.\nNever returned by any read endpoint.\n"
|
|
6523
|
+
}
|
|
6524
|
+
},
|
|
6525
|
+
"required": ["key", "value"]
|
|
6526
|
+
},
|
|
6527
|
+
"SetOrgSecretInput": {
|
|
6528
|
+
"type": "object",
|
|
6529
|
+
"additionalProperties": false,
|
|
6530
|
+
"description": "Body for PUT /org/secrets/{key}. Key comes from the path.",
|
|
6531
|
+
"properties": { "value": {
|
|
6532
|
+
"type": "string",
|
|
6533
|
+
"minLength": 1,
|
|
6534
|
+
"maxLength": 4096
|
|
6535
|
+
} },
|
|
6536
|
+
"required": ["value"]
|
|
6537
|
+
},
|
|
6538
|
+
"OrgSecretWriteResult": {
|
|
6539
|
+
"type": "object",
|
|
6540
|
+
"description": "Returned by POST and PUT org secret routes.",
|
|
6541
|
+
"properties": {
|
|
6542
|
+
"key": { "type": "string" },
|
|
6543
|
+
"created_at": {
|
|
6544
|
+
"type": "string",
|
|
6545
|
+
"format": "date-time"
|
|
6546
|
+
},
|
|
6547
|
+
"updated_at": {
|
|
6548
|
+
"type": "string",
|
|
6549
|
+
"format": "date-time"
|
|
6550
|
+
},
|
|
6551
|
+
"created": {
|
|
6552
|
+
"type": "boolean",
|
|
6553
|
+
"description": "True if this call inserted a new row, false if it updated an existing one."
|
|
6554
|
+
}
|
|
6555
|
+
},
|
|
6556
|
+
"required": [
|
|
6557
|
+
"key",
|
|
6558
|
+
"created_at",
|
|
6559
|
+
"updated_at",
|
|
6560
|
+
"created"
|
|
6561
|
+
]
|
|
6350
6562
|
}
|
|
6351
6563
|
}
|
|
6352
6564
|
}
|
|
@@ -6375,6 +6587,39 @@ const operationManifest = [
|
|
|
6375
6587
|
},
|
|
6376
6588
|
"email": { "type": "string" },
|
|
6377
6589
|
"plan": { "type": "string" },
|
|
6590
|
+
"limits": {
|
|
6591
|
+
"type": "object",
|
|
6592
|
+
"description": "Plan-derived quota limits for an account.",
|
|
6593
|
+
"properties": {
|
|
6594
|
+
"storage_mb": { "type": "number" },
|
|
6595
|
+
"send_per_hour": { "type": "number" },
|
|
6596
|
+
"send_per_day": { "type": "number" },
|
|
6597
|
+
"api_per_minute": { "type": "number" },
|
|
6598
|
+
"webhooks_max_global": { "type": ["number", "null"] },
|
|
6599
|
+
"webhooks_per_domain": { "type": "boolean" },
|
|
6600
|
+
"filters_per_domain": { "type": "boolean" },
|
|
6601
|
+
"spam_thresholds_per_domain": { "type": "boolean" }
|
|
6602
|
+
},
|
|
6603
|
+
"required": [
|
|
6604
|
+
"storage_mb",
|
|
6605
|
+
"send_per_hour",
|
|
6606
|
+
"send_per_day",
|
|
6607
|
+
"api_per_minute",
|
|
6608
|
+
"webhooks_max_global",
|
|
6609
|
+
"webhooks_per_domain",
|
|
6610
|
+
"filters_per_domain",
|
|
6611
|
+
"spam_thresholds_per_domain"
|
|
6612
|
+
]
|
|
6613
|
+
},
|
|
6614
|
+
"entitlements": {
|
|
6615
|
+
"type": "array",
|
|
6616
|
+
"items": { "type": "string" },
|
|
6617
|
+
"description": "Granted org entitlement keys (sorted). A headless caller reads its\ncapabilities here — e.g. an emailless agent seeing only\n[\"send_mail\", \"send_to_known_addresses\"] knows it is reply-only.\n"
|
|
6618
|
+
},
|
|
6619
|
+
"managed_inbox_address": {
|
|
6620
|
+
"type": ["string", "null"],
|
|
6621
|
+
"description": "The managed inbox FQDN to reply as, or null if the org has no managed inbox."
|
|
6622
|
+
},
|
|
6378
6623
|
"created_at": {
|
|
6379
6624
|
"type": "string",
|
|
6380
6625
|
"format": "date-time"
|
|
@@ -6402,6 +6647,9 @@ const operationManifest = [
|
|
|
6402
6647
|
"id",
|
|
6403
6648
|
"email",
|
|
6404
6649
|
"plan",
|
|
6650
|
+
"limits",
|
|
6651
|
+
"entitlements",
|
|
6652
|
+
"managed_inbox_address",
|
|
6405
6653
|
"created_at",
|
|
6406
6654
|
"discard_content_on_webhook_confirmed"
|
|
6407
6655
|
]
|
|
@@ -8858,6 +9106,22 @@ const operationManifest = [
|
|
|
8858
9106
|
"name": "date_to",
|
|
8859
9107
|
"required": false,
|
|
8860
9108
|
"type": "string"
|
|
9109
|
+
},
|
|
9110
|
+
{
|
|
9111
|
+
"description": "Forward-tail cursor. Returns rows that became visible AFTER this\ncursor, oldest-first, so a caller can stream new inbound mail by\nre-passing the cursor from each response. Mutually exclusive with\n`cursor` (which pages history newest-first). Pass the `meta.cursor`\nfrom the previous `since` response; an empty page means caught up.\n",
|
|
9112
|
+
"enum": null,
|
|
9113
|
+
"name": "since",
|
|
9114
|
+
"required": false,
|
|
9115
|
+
"type": "string"
|
|
9116
|
+
},
|
|
9117
|
+
{
|
|
9118
|
+
"description": "Long-poll: hold the request up to this many seconds waiting for new\nmail past `since`, returning as soon as any arrives (or an empty\npage when the wait elapses). Requires `since`. Omitted means no wait\n(returns immediately); the server treats an absent value as 0. NOT\ngiven an OpenAPI `default` on purpose: a default makes some\ngenerators (e.g. openapi-python-client) send `wait=0` on every call,\nwhich then fails the `wait` requires `since` check for plain history\nlistings.\n",
|
|
9119
|
+
"enum": null,
|
|
9120
|
+
"maximum": 30,
|
|
9121
|
+
"minimum": 0,
|
|
9122
|
+
"name": "wait",
|
|
9123
|
+
"required": false,
|
|
9124
|
+
"type": "integer"
|
|
8861
9125
|
}
|
|
8862
9126
|
],
|
|
8863
9127
|
"requestSchema": null,
|
|
@@ -9867,7 +10131,7 @@ const operationManifest = [
|
|
|
9867
10131
|
"binaryResponse": false,
|
|
9868
10132
|
"bodyRequired": true,
|
|
9869
10133
|
"command": "create-function",
|
|
9870
|
-
"description": "Creates and deploys a new function. The handler must be a single\nESM module whose default export is an object with an async\n`fetch(request, env)` method (Workers-style). Primitive signs\neach delivery and forwards the `Primitive-Signature` header to\nthe handler. Verify the raw request body with\n`PRIMITIVE_WEBHOOK_SECRET` before parsing JSON; after verification\nthe request body parses to
|
|
10134
|
+
"description": "Creates and deploys a new function. The handler must be a single\nESM module whose default export is an object with an async\n`fetch(request, env)` method (Workers-style). Primitive signs\neach delivery and forwards the `Primitive-Signature` header to\nthe handler. Verify the raw request body with\n`PRIMITIVE_WEBHOOK_SECRET` before parsing JSON; after verification\nthe request body parses to a webhook event whose `event` field is\n`email.received` for normal inbound mail, or a machine-mail type\n(`email.bounced`, `email.tls_report`, `email.dmarc_report`,\n`email.dmarc_failure`) for bounces and reports. Code is bundled\nbefore being uploaded; ship a single self-contained file rather\nthan relying on external imports.\n\n**Code limits.** `code` is capped at 1 MiB UTF-8. `sourceMap`\n(optional) is capped at 5 MiB UTF-8, stored with each deployment\nattempt, and sent to the runtime so stack traces can resolve to\noriginal source files.\n\n**Routing.** On successful deploy, the function code is live\nin the runtime, but inbound mail will not reach it until at\nleast one route is bound. Routes are managed from the Primitive\ndashboard. A `deploy_status` of `deployed` means the script is\ninstalled, not that the function is receiving mail. The\ninternal runtime URL is not returned by the API and is not a\ncustomer-facing integration surface.\n\n**Secrets.** New functions ship with the managed secrets\n(`PRIMITIVE_WEBHOOK_SECRET`, `PRIMITIVE_API_KEY`,\n`PRIMITIVE_API_BASE_URL`) already bound. Add user-set secrets via\n`POST /functions/{id}/secrets`; secret writes only land in the\nrunning handler on the next redeploy.\n",
|
|
9871
10135
|
"hasJsonBody": true,
|
|
9872
10136
|
"method": "POST",
|
|
9873
10137
|
"operationId": "createFunction",
|
|
@@ -9999,6 +10263,66 @@ const operationManifest = [
|
|
|
9999
10263
|
"tag": "Functions",
|
|
10000
10264
|
"tagCommand": "functions"
|
|
10001
10265
|
},
|
|
10266
|
+
{
|
|
10267
|
+
"binaryResponse": false,
|
|
10268
|
+
"bodyRequired": true,
|
|
10269
|
+
"command": "create-org-secret",
|
|
10270
|
+
"description": "Idempotent insert-or-update keyed on `(org_id, key)`. Returns\n201 the first time the key is set, 200 on subsequent updates.\nValues are encrypted at rest. A changed value lands in a\nfunction only on that function's next deploy.\n\nKeys must match `^[A-Z_][A-Z0-9_]*$` (uppercase letters,\ndigits, underscores; first character is a letter or\nunderscore). Values are at most 4096 UTF-8 bytes. System-\nmanaged keys are reserved and rejected.\n",
|
|
10271
|
+
"hasJsonBody": true,
|
|
10272
|
+
"method": "POST",
|
|
10273
|
+
"operationId": "createOrgSecret",
|
|
10274
|
+
"path": "/org/secrets",
|
|
10275
|
+
"pathParams": [],
|
|
10276
|
+
"queryParams": [],
|
|
10277
|
+
"requestSchema": {
|
|
10278
|
+
"type": "object",
|
|
10279
|
+
"additionalProperties": false,
|
|
10280
|
+
"description": "Body for POST /org/secrets.",
|
|
10281
|
+
"properties": {
|
|
10282
|
+
"key": {
|
|
10283
|
+
"type": "string",
|
|
10284
|
+
"pattern": "^[A-Z_][A-Z0-9_]*$",
|
|
10285
|
+
"description": "Uppercase letters, digits, and underscores. Must start with\na letter or underscore. System-managed keys are reserved.\n"
|
|
10286
|
+
},
|
|
10287
|
+
"value": {
|
|
10288
|
+
"type": "string",
|
|
10289
|
+
"minLength": 1,
|
|
10290
|
+
"maxLength": 4096,
|
|
10291
|
+
"description": "Secret value, up to 4096 UTF-8 bytes. Encrypted at rest.\nNever returned by any read endpoint.\n"
|
|
10292
|
+
}
|
|
10293
|
+
},
|
|
10294
|
+
"required": ["key", "value"]
|
|
10295
|
+
},
|
|
10296
|
+
"responseSchema": {
|
|
10297
|
+
"type": "object",
|
|
10298
|
+
"description": "Returned by POST and PUT org secret routes.",
|
|
10299
|
+
"properties": {
|
|
10300
|
+
"key": { "type": "string" },
|
|
10301
|
+
"created_at": {
|
|
10302
|
+
"type": "string",
|
|
10303
|
+
"format": "date-time"
|
|
10304
|
+
},
|
|
10305
|
+
"updated_at": {
|
|
10306
|
+
"type": "string",
|
|
10307
|
+
"format": "date-time"
|
|
10308
|
+
},
|
|
10309
|
+
"created": {
|
|
10310
|
+
"type": "boolean",
|
|
10311
|
+
"description": "True if this call inserted a new row, false if it updated an existing one."
|
|
10312
|
+
}
|
|
10313
|
+
},
|
|
10314
|
+
"required": [
|
|
10315
|
+
"key",
|
|
10316
|
+
"created_at",
|
|
10317
|
+
"updated_at",
|
|
10318
|
+
"created"
|
|
10319
|
+
]
|
|
10320
|
+
},
|
|
10321
|
+
"sdkName": "createOrgSecret",
|
|
10322
|
+
"summary": "Create or update an org secret",
|
|
10323
|
+
"tag": "Functions",
|
|
10324
|
+
"tagCommand": "functions"
|
|
10325
|
+
},
|
|
10002
10326
|
{
|
|
10003
10327
|
"binaryResponse": false,
|
|
10004
10328
|
"bodyRequired": false,
|
|
@@ -10053,6 +10377,30 @@ const operationManifest = [
|
|
|
10053
10377
|
"tag": "Functions",
|
|
10054
10378
|
"tagCommand": "functions"
|
|
10055
10379
|
},
|
|
10380
|
+
{
|
|
10381
|
+
"binaryResponse": false,
|
|
10382
|
+
"bodyRequired": false,
|
|
10383
|
+
"command": "delete-org-secret",
|
|
10384
|
+
"description": "Removes the org secret. Functions keep the previous value until\neach is redeployed. Returns 404 if the key did not exist.\n",
|
|
10385
|
+
"hasJsonBody": false,
|
|
10386
|
+
"method": "DELETE",
|
|
10387
|
+
"operationId": "deleteOrgSecret",
|
|
10388
|
+
"path": "/org/secrets/{key}",
|
|
10389
|
+
"pathParams": [{
|
|
10390
|
+
"description": "Secret key. Must match `^[A-Z_][A-Z0-9_]*$`.",
|
|
10391
|
+
"enum": null,
|
|
10392
|
+
"name": "key",
|
|
10393
|
+
"required": true,
|
|
10394
|
+
"type": "string"
|
|
10395
|
+
}],
|
|
10396
|
+
"queryParams": [],
|
|
10397
|
+
"requestSchema": null,
|
|
10398
|
+
"responseSchema": null,
|
|
10399
|
+
"sdkName": "deleteOrgSecret",
|
|
10400
|
+
"summary": "Delete an org secret",
|
|
10401
|
+
"tag": "Functions",
|
|
10402
|
+
"tagCommand": "functions"
|
|
10403
|
+
},
|
|
10056
10404
|
{
|
|
10057
10405
|
"binaryResponse": false,
|
|
10058
10406
|
"bodyRequired": false,
|
|
@@ -10933,6 +11281,50 @@ const operationManifest = [
|
|
|
10933
11281
|
"tag": "Functions",
|
|
10934
11282
|
"tagCommand": "functions"
|
|
10935
11283
|
},
|
|
11284
|
+
{
|
|
11285
|
+
"binaryResponse": false,
|
|
11286
|
+
"bodyRequired": false,
|
|
11287
|
+
"command": "list-org-secrets",
|
|
11288
|
+
"description": "Returns metadata for every org-level secret. Org secrets apply\nto every function in the org and are read as `env.<KEY>` in\nhandlers. **Values are never returned.** Secret writes are\nwrite-only. A function-level secret of the same name overrides\nthe org-level value for that function.\n",
|
|
11289
|
+
"hasJsonBody": false,
|
|
11290
|
+
"method": "GET",
|
|
11291
|
+
"operationId": "listOrgSecrets",
|
|
11292
|
+
"path": "/org/secrets",
|
|
11293
|
+
"pathParams": [],
|
|
11294
|
+
"queryParams": [],
|
|
11295
|
+
"requestSchema": null,
|
|
11296
|
+
"responseSchema": {
|
|
11297
|
+
"type": "object",
|
|
11298
|
+
"properties": { "items": {
|
|
11299
|
+
"type": "array",
|
|
11300
|
+
"items": {
|
|
11301
|
+
"type": "object",
|
|
11302
|
+
"description": "One row from GET /org/secrets. Org secrets are always user-set\n(there are no managed org secrets), so `created_at` /\n`updated_at` are always present.\n",
|
|
11303
|
+
"properties": {
|
|
11304
|
+
"key": { "type": "string" },
|
|
11305
|
+
"created_at": {
|
|
11306
|
+
"type": "string",
|
|
11307
|
+
"format": "date-time"
|
|
11308
|
+
},
|
|
11309
|
+
"updated_at": {
|
|
11310
|
+
"type": "string",
|
|
11311
|
+
"format": "date-time"
|
|
11312
|
+
}
|
|
11313
|
+
},
|
|
11314
|
+
"required": [
|
|
11315
|
+
"key",
|
|
11316
|
+
"created_at",
|
|
11317
|
+
"updated_at"
|
|
11318
|
+
]
|
|
11319
|
+
}
|
|
11320
|
+
} },
|
|
11321
|
+
"required": ["items"]
|
|
11322
|
+
},
|
|
11323
|
+
"sdkName": "listOrgSecrets",
|
|
11324
|
+
"summary": "List org-level (global) secrets",
|
|
11325
|
+
"tag": "Functions",
|
|
11326
|
+
"tagCommand": "functions"
|
|
11327
|
+
},
|
|
10936
11328
|
{
|
|
10937
11329
|
"binaryResponse": false,
|
|
10938
11330
|
"bodyRequired": true,
|
|
@@ -11121,6 +11513,64 @@ const operationManifest = [
|
|
|
11121
11513
|
"tag": "Functions",
|
|
11122
11514
|
"tagCommand": "functions"
|
|
11123
11515
|
},
|
|
11516
|
+
{
|
|
11517
|
+
"binaryResponse": false,
|
|
11518
|
+
"bodyRequired": true,
|
|
11519
|
+
"command": "set-org-secret",
|
|
11520
|
+
"description": "Path-keyed companion to `POST /org/secrets`. Idempotent:\nreturns 201 the first time the key is set, 200 on subsequent\nupdates. Same validation and write-only guarantees as POST.\n",
|
|
11521
|
+
"hasJsonBody": true,
|
|
11522
|
+
"method": "PUT",
|
|
11523
|
+
"operationId": "setOrgSecret",
|
|
11524
|
+
"path": "/org/secrets/{key}",
|
|
11525
|
+
"pathParams": [{
|
|
11526
|
+
"description": "Secret key. Must match `^[A-Z_][A-Z0-9_]*$`.",
|
|
11527
|
+
"enum": null,
|
|
11528
|
+
"name": "key",
|
|
11529
|
+
"required": true,
|
|
11530
|
+
"type": "string"
|
|
11531
|
+
}],
|
|
11532
|
+
"queryParams": [],
|
|
11533
|
+
"requestSchema": {
|
|
11534
|
+
"type": "object",
|
|
11535
|
+
"additionalProperties": false,
|
|
11536
|
+
"description": "Body for PUT /org/secrets/{key}. Key comes from the path.",
|
|
11537
|
+
"properties": { "value": {
|
|
11538
|
+
"type": "string",
|
|
11539
|
+
"minLength": 1,
|
|
11540
|
+
"maxLength": 4096
|
|
11541
|
+
} },
|
|
11542
|
+
"required": ["value"]
|
|
11543
|
+
},
|
|
11544
|
+
"responseSchema": {
|
|
11545
|
+
"type": "object",
|
|
11546
|
+
"description": "Returned by POST and PUT org secret routes.",
|
|
11547
|
+
"properties": {
|
|
11548
|
+
"key": { "type": "string" },
|
|
11549
|
+
"created_at": {
|
|
11550
|
+
"type": "string",
|
|
11551
|
+
"format": "date-time"
|
|
11552
|
+
},
|
|
11553
|
+
"updated_at": {
|
|
11554
|
+
"type": "string",
|
|
11555
|
+
"format": "date-time"
|
|
11556
|
+
},
|
|
11557
|
+
"created": {
|
|
11558
|
+
"type": "boolean",
|
|
11559
|
+
"description": "True if this call inserted a new row, false if it updated an existing one."
|
|
11560
|
+
}
|
|
11561
|
+
},
|
|
11562
|
+
"required": [
|
|
11563
|
+
"key",
|
|
11564
|
+
"created_at",
|
|
11565
|
+
"updated_at",
|
|
11566
|
+
"created"
|
|
11567
|
+
]
|
|
11568
|
+
},
|
|
11569
|
+
"sdkName": "setOrgSecret",
|
|
11570
|
+
"summary": "Set an org secret by key",
|
|
11571
|
+
"tag": "Functions",
|
|
11572
|
+
"tagCommand": "functions"
|
|
11573
|
+
},
|
|
11124
11574
|
{
|
|
11125
11575
|
"binaryResponse": false,
|
|
11126
11576
|
"bodyRequired": false,
|
package/dist/parser/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { F as WebhookAttachment, l as EmailAddress, w as ParsedDataComplete } from "../types-QT2ss9ho.js";
|
|
2
2
|
import { a as parseFromHeader, i as ValidatedAddress, n as ParseFromHeaderResult, o as parseFromHeaderLoose, r as ParsedAddress, t as ParseFromHeaderFailureReason } from "../address-parser-CA6G7R-h.js";
|
|
3
3
|
|
|
4
4
|
//#region src/parser/attachment-parser.d.ts
|