@myapihq/cli 2.6.2 → 2.7.1
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/commands/container-deploy-safety.test.d.ts +1 -0
- package/dist/commands/container-deploy-safety.test.js +60 -0
- package/dist/commands/container.d.ts +4 -0
- package/dist/commands/container.js +211 -8
- package/dist/commands/crm/companies.js +6 -11
- package/dist/commands/crm/contacts.js +6 -11
- package/dist/commands/crm/pagination.d.ts +1 -4
- package/dist/commands/crm/pagination.js +24 -52
- package/dist/commands/crm/pagination.test.js +34 -70
- package/dist/commands/database.js +21 -14
- package/dist/commands/doctor.js +1 -1
- package/dist/commands/domain.js +6 -6
- package/dist/commands/fn.js +11 -11
- package/dist/errors.js +21 -5
- package/dist/sdk-container.test.js +58 -1
- package/dist/skills/my-container-api/SKILL.md +31 -3
- package/dist/skills/my-crm-api/SKILL.md +6 -7
- package/dist/skills/my-database-api/README.md +1 -1
- package/dist/skills/my-database-api/SKILL.md +4 -4
- package/dist/skills/my-domain-api/SKILL.md +2 -2
- package/dist/skills/my-function-api/SKILL.md +16 -16
- package/dist/skills/my-git-api/SKILL.md +4 -4
- package/package.json +3 -2
|
@@ -2,26 +2,26 @@
|
|
|
2
2
|
name: my-function-api
|
|
3
3
|
version: 1.0.0
|
|
4
4
|
description: >
|
|
5
|
-
Deploy JavaScript functions to the MyAPI edge runtime
|
|
5
|
+
Deploy JavaScript functions to the MyAPI edge runtime. Register a function, upload a single-file JS bundle, get a live HTTP invocation URL or run it on a cron schedule. Each function gets a scoped capability key for cross-slot calls.
|
|
6
6
|
triggers: [function, deploy function, edge function, serverless, cloudflare worker, cron, scoped api key, capability key, invocation url, bundle]
|
|
7
|
-
checksum: sha256-
|
|
7
|
+
checksum: sha256-08524ea08e91dcb6c8b68b64a7b4034d24a98a18968acd4ba80e45dbd6f85d09
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# MyFunctionAPI
|
|
11
11
|
|
|
12
|
-
Deploy backend code without running a server. Register a function, upload a single-file JS bundle, and it goes live on the MyAPI edge runtime
|
|
12
|
+
Deploy backend code without running a server. Register a function, upload a single-file JS bundle, and it goes live on the MyAPI edge runtime with a public invocation URL — or runs on a cron schedule. Each function carries a scoped capability key so it can call other MyAPI slots with its own authority.
|
|
13
13
|
|
|
14
14
|
The full loop is live: **create → deploy → invoke → inspect runs → set secrets**.
|
|
15
15
|
|
|
16
16
|
## Capabilities
|
|
17
17
|
<!-- llm:start -->
|
|
18
|
-
**Two-step lifecycle: register, then deploy.** `myapi fn create --name <slug>` persists the function record and mints a `scoped_api_key`, returned **exactly once** (save it if you need it). `myapi fn deploy <id> <bundle.js>` uploads a single-file JavaScript bundle (≤4MB); the backend wraps it with the MYAPI shim and ships it to
|
|
18
|
+
**Two-step lifecycle: register, then deploy.** `myapi fn create --name <slug>` persists the function record and mints a `scoped_api_key`, returned **exactly once** (save it if you need it). `myapi fn deploy <id> <bundle.js>` uploads a single-file JavaScript bundle (≤4MB); the backend wraps it with the MYAPI shim and ships it to the edge runtime. Propagation is typically 4-45s, so poll the invocation URL rather than redeploying. After deploy the function has a live `invocation_url`.
|
|
19
19
|
|
|
20
20
|
**Scoped key = capability key.** It is **org-locked**. By default it inherits the deployer's slot grants; narrow it at create time with `--scope <slot>[,<slot>...]` (comma-separated, e.g. `--scope email,storage`) — the primary way to deploy a deliberately narrow function. Grants can never exceed the caller's, so a function never out-reaches the credential that created it. It is rejected with `403 SCOPE_FORBIDDEN` at `/hq/*`, `/admin/*`, `/internal/*`. **Deploy rotates this key** — the fresh value is printed once on every deploy. (Minting a narrow account key first — `myapi keys create --grant ...` — is only needed when the *deploy credential itself* must be constrained, e.g. handing deploy rights to another system.)
|
|
21
21
|
|
|
22
22
|
**HTTP or cron triggers.** Default is `http` — the function gets a public invocation URL once deployed. Pass `--cron "<expr>"` at create time to run on a schedule (e.g. `"0 8 * * *"`) instead.
|
|
23
23
|
|
|
24
|
-
**Secrets
|
|
24
|
+
**Secrets are encrypted at rest.** `myapi fn env <id> <name> <value>` sets a secret (Stripe key, API token, …) on a deployed function. The value is encrypted at rest by the edge runtime and never stored or echoed by MyAPI. The function must already be deployed.
|
|
25
25
|
|
|
26
26
|
**Inspect invocations.** `myapi fn runs <id>` lists recent invocation records (most recent first, up to 100) with status, duration, and any error message.
|
|
27
27
|
|
|
@@ -35,12 +35,12 @@ Name rules (validated client- and server-side, kept identical):
|
|
|
35
35
|
| Command | What it does |
|
|
36
36
|
|---|---|
|
|
37
37
|
| `myapi fn create --name <name> [--cron <expr>] [--scope <slot>[,<slot>...]]` | Register a function record + receive scoped API key (returned once). `--scope` narrows the key's slot grants |
|
|
38
|
-
| `myapi fn deploy <id> <bundle.js>` | Upload a single-file JS bundle (≤4MB) and go live; rotates the scoped key |
|
|
39
|
-
| `myapi fn env <id> <name> <value>` | Set
|
|
38
|
+
| `myapi fn deploy <id> <bundle.js>` | Upload a single-file JS bundle (≤4MB) and go live; rotates the scoped API key |
|
|
39
|
+
| `myapi fn env <id> <name> <value>` | Set an encrypted secret on a deployed function |
|
|
40
40
|
| `myapi fn runs <id>` | List recent invocation records (status, duration, errors) |
|
|
41
41
|
| `myapi fn list` | List functions in your org |
|
|
42
42
|
| `myapi fn get <id>` | Inspect a function (name, trigger, invocation URL) |
|
|
43
|
-
| `myapi fn delete <id>` | Soft-delete the record + revoke the scoped key |
|
|
43
|
+
| `myapi fn delete <id>` | Soft-delete the record + revoke the scoped API key |
|
|
44
44
|
<!-- generated:end -->
|
|
45
45
|
|
|
46
46
|
## Examples
|
|
@@ -50,15 +50,15 @@ Name rules (validated client- and server-side, kept identical):
|
|
|
50
50
|
myapi fn create --name my-app-api
|
|
51
51
|
# → Function created: fn_abc123
|
|
52
52
|
# Scoped API key (returned once — save it if you need it):
|
|
53
|
-
# hq_live_... (scoped keys are not visually distinct from account keys)
|
|
53
|
+
# hq_live_... (scoped API keys are not visually distinct from account keys)
|
|
54
54
|
|
|
55
|
-
# Deploy a single-file JS bundle → goes live, scoped key is rotated
|
|
55
|
+
# Deploy a single-file JS bundle → goes live, scoped API key is rotated
|
|
56
56
|
myapi fn deploy fn_abc123 ./dist/bundle.js
|
|
57
57
|
# → Deployed function fn_abc123
|
|
58
58
|
# Invocation URL: https://fn-abc123.<...>.workers.dev
|
|
59
59
|
# Scoped API key was rotated. New value (returned once): hq_live_...
|
|
60
60
|
|
|
61
|
-
# Set a secret (encrypted at rest
|
|
61
|
+
# Set a secret (encrypted at rest; never echoed)
|
|
62
62
|
myapi fn env fn_abc123 STRIPE_KEY sk_live_...
|
|
63
63
|
|
|
64
64
|
# Inspect recent invocations
|
|
@@ -74,17 +74,17 @@ myapi fn create --name mailer --scope email,storage
|
|
|
74
74
|
myapi fn list
|
|
75
75
|
myapi fn get fn_abc123
|
|
76
76
|
|
|
77
|
-
# Delete (revokes the scoped key — future calls with it return 401)
|
|
77
|
+
# Delete (revokes the scoped API key — future calls with it return 401)
|
|
78
78
|
myapi fn delete fn_abc123
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
### Using the scoped key
|
|
81
|
+
### Using the scoped API key
|
|
82
82
|
|
|
83
83
|
```bash
|
|
84
|
-
# Save the key returned at create/deploy time
|
|
84
|
+
# Save the API key returned at create/deploy time
|
|
85
85
|
SCOPED_KEY="hq_live_..."
|
|
86
86
|
|
|
87
|
-
# Call slots the key was granted — works (within its org + grants)
|
|
87
|
+
# Call slots the API key was granted — works (within its org + grants)
|
|
88
88
|
curl -H "Authorization: Bearer $SCOPED_KEY" \
|
|
89
89
|
https://api.myapihq.com/database/orgs/$ORG_ID/namespaces
|
|
90
90
|
|
|
@@ -99,6 +99,6 @@ curl -H "Authorization: Bearer $SCOPED_KEY" \
|
|
|
99
99
|
|
|
100
100
|
- The bundle is a **single JavaScript file** (≤4MB). Bundle your dependencies before deploy (esbuild/rollup/etc.).
|
|
101
101
|
- `--cron` is set at create time; the trigger type is fixed for the function's lifetime.
|
|
102
|
-
- Deploy rotates the scoped key on every call — re-capture the printed value if other systems use it.
|
|
102
|
+
- Deploy rotates the scoped API key on every call — re-capture the printed value if other systems use it.
|
|
103
103
|
|
|
104
104
|
Run `myapi fn --help` or `myapi fn <subcommand> --help` for full flag reference.
|
|
@@ -4,7 +4,7 @@ version: 1.0.0
|
|
|
4
4
|
description: >
|
|
5
5
|
Hosted git repositories over HTTP. Create repos, read history (log/show/tree/blob/diff), and write atomically (commit/branch/tag/merge) — no clone needed. Real `git clone`/`push` also work over HTTPS with your API key as the password.
|
|
6
6
|
triggers: [git, repo, repository, clone, push, commit, branch, tag, merge, diff, version control, source control, vcs]
|
|
7
|
-
checksum: sha256-
|
|
7
|
+
checksum: sha256-921cedea836edac33fefabfb46102e241d2618529db2e307cc73f4d910e7fee3
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# MyGitAPI
|
|
@@ -90,7 +90,7 @@ myapi git delete-branch my-app feature
|
|
|
90
90
|
### Clone & push with real git
|
|
91
91
|
Hosted repos speak the real git smart-HTTP protocol. Clone, fetch, and push
|
|
92
92
|
over HTTPS with **HTTP Basic auth — your MyAPI API key is the password**, any
|
|
93
|
-
username works (git accepts the key in either field).
|
|
93
|
+
username works (git accepts the API key in either field).
|
|
94
94
|
|
|
95
95
|
```bash
|
|
96
96
|
# URL: https://git.mygitapi.com/<org-slug>/<repo>.git
|
|
@@ -100,7 +100,7 @@ username works (git accepts the key in either field).
|
|
|
100
100
|
# Clone (key as password; "x" is a throwaway username)
|
|
101
101
|
git clone https://x:$MYAPI_KEY@git.mygitapi.com/my-org-slug/my-app.git
|
|
102
102
|
|
|
103
|
-
# Or set the remote and let git prompt for the password (paste the key)
|
|
103
|
+
# Or set the remote and let git prompt for the password (paste the API key)
|
|
104
104
|
git remote add origin https://git.mygitapi.com/my-org-slug/my-app.git
|
|
105
105
|
git push origin main
|
|
106
106
|
```
|
|
@@ -117,6 +117,6 @@ surface never leaks which repos exist).
|
|
|
117
117
|
- **`commit --base`** is the concurrency guard: pass the expected tip SHA to reject a stale write, or `--base ""` to require the branch be newly created. Omit it to create-or-update.
|
|
118
118
|
- **Metering.** A `git push` (and `myapi git commit`) is metered like a commit. Clone/fetch (`upload-pack`) is free.
|
|
119
119
|
- **Limits.** A push body is capped at 100 MiB; per-repo size limits apply (a push past the cap is reported as a receive-pack failure).
|
|
120
|
-
- **Auth field.** git may put the key in the username or password slot — both work. Embedding it in the URL (`https://x:$KEY@…`) avoids the interactive prompt but writes the key into `.git/config`; use a credential helper for anything persistent.
|
|
120
|
+
- **Auth field.** git may put the API key in the username or password slot — both work. Embedding it in the URL (`https://x:$KEY@…`) avoids the interactive prompt but writes the API key into `.git/config`; use a credential helper for anything persistent.
|
|
121
121
|
|
|
122
122
|
Run `myapi git --help` for the full flag reference.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myapihq/cli",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.7.1",
|
|
5
5
|
"description": "MyAPI command-line interface",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -35,12 +35,13 @@
|
|
|
35
35
|
"lint:help-order": "node scripts/lint-help-order.js",
|
|
36
36
|
"lint:exposes": "node scripts/lint-exposes.js",
|
|
37
37
|
"lint:request-fields": "node scripts/lint-request-fields.js",
|
|
38
|
+
"audit:doctor": "npm run build && node scripts/audit-doctor.js",
|
|
38
39
|
"lint:docs": "node scripts/lint-docs.js",
|
|
39
40
|
"lint:skills": "node scripts/copy-skills.js && node scripts/lint-skills.js",
|
|
40
41
|
"lint:skills:strict": "node scripts/copy-skills.js && node scripts/lint-skills.js --strict"
|
|
41
42
|
},
|
|
42
43
|
"dependencies": {
|
|
43
|
-
"@myapihq/sdk": "^2.
|
|
44
|
+
"@myapihq/sdk": "^2.7.1"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
47
|
"@types/node": "^25.6.0",
|