@primitivedotdev/sdk 0.21.0 → 0.22.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.
@@ -571,6 +571,25 @@ function collectValues(parameters, flags) {
571
571
  }
572
572
  return values;
573
573
  }
574
+ // Discoverability hints for generated commands that have a
575
+ // hand-rolled ergonomic shortcut. Keyed by the manifest's
576
+ // `sdkName` (camelCase, matches the generated SDK function). The
577
+ // hint is appended to the operation's --help description so an
578
+ // agent reading `<command> --help` finds the shortcut without
579
+ // having to enumerate the full command list. AGX walkthrough:
580
+ // an agent reached for `functions:update-function` to redeploy
581
+ // (which forces a JSON-stringified `code` body) when
582
+ // `functions:redeploy --file <bundle>` was the intended path.
583
+ //
584
+ // Add an entry here whenever a hand-rolled shortcut shadows a
585
+ // generated operation; the COMMANDS map in `index.ts` is the
586
+ // authoritative list of shortcuts.
587
+ export const OPERATION_HINTS = {
588
+ createFunction: "Tip: prefer `primitive functions:deploy --name <name> --file <bundle>` for file-input ergonomics. This raw command exists for callers passing JSON.",
589
+ updateFunction: "Tip: prefer `primitive functions:redeploy --id <id> --file <bundle>` for file-input ergonomics. This raw command exists for callers passing JSON.",
590
+ createFunctionSecret: "Tip: prefer `primitive functions:set-secret --id <id> --key <KEY> --value <value> [--redeploy]` for secret writes that also push the binding live. This raw command exists for callers passing JSON.",
591
+ setFunctionSecret: "Tip: prefer `primitive functions:set-secret --id <id> --key <KEY> --value <value> [--redeploy]` for secret writes that also push the binding live. This raw command exists for callers passing JSON.",
592
+ };
574
593
  export function createOperationCommand(operation) {
575
594
  const { flags, bodyFieldFlagToProperty } = buildFlags(operation);
576
595
  // Append a "Body fields" summary to the description so agents
@@ -582,9 +601,13 @@ export function createOperationCommand(operation) {
582
601
  const schemaSummary = operation.hasJsonBody
583
602
  ? renderRequestSchemaSummary(operation.requestSchema)
584
603
  : null;
585
- const fullDescription = schemaSummary
604
+ const hint = OPERATION_HINTS[operation.sdkName];
605
+ const descriptionWithSchema = schemaSummary
586
606
  ? `${baseDescription}\n\n${schemaSummary}`
587
607
  : baseDescription;
608
+ const fullDescription = hint
609
+ ? `${descriptionWithSchema}\n\n${hint}`
610
+ : descriptionWithSchema;
588
611
  class OperationCommand extends Command {
589
612
  static description = fullDescription;
590
613
  static flags = flags;
@@ -0,0 +1,213 @@
1
+ import { Command, Flags } from "@oclif/core";
2
+ import { getFunction, setFunctionSecret, updateFunction, } from "../../api/generated/sdk.gen.js";
3
+ import { PrimitiveApiClient } from "../../api/index.js";
4
+ import { extractErrorPayload, removeStaleSavedCredentialOnUnauthorized, runWithTiming, TIME_FLAG_DESCRIPTION, writeErrorWithHints, } from "../api-command.js";
5
+ import { resolveCliAuth } from "../auth.js";
6
+ // Pure-ish orchestration of the set-secret + optional redeploy
7
+ // flow. Pulled out as a named export so the unit test can drive
8
+ // both the happy path and each error stage with a fake API
9
+ // surface, without spinning up a real client or the oclif
10
+ // command lifecycle.
11
+ //
12
+ // The redeploy step uses the function's CURRENT code (fetched via
13
+ // getFunction) as the new bundle. This is the documented way to
14
+ // "refresh secret bindings without changing the handler": the
15
+ // server-side deploy reads the secrets table fresh on every call,
16
+ // so re-deploying the same code picks up the secret we just wrote.
17
+ export async function runSetSecret(api, params) {
18
+ const setResult = await api.setSecret({
19
+ id: params.id,
20
+ key: params.key,
21
+ value: params.value,
22
+ });
23
+ if (setResult.error) {
24
+ return {
25
+ kind: "error",
26
+ payload: extractErrorPayload(setResult.error),
27
+ stage: "set-secret",
28
+ };
29
+ }
30
+ const secret = setResult.data?.data;
31
+ if (!secret) {
32
+ // Server returned 2xx with no `data` body. Treat as an error
33
+ // so we don't fabricate a success payload; this should not
34
+ // happen in practice but the shape forces us to handle it.
35
+ return {
36
+ kind: "error",
37
+ payload: {
38
+ code: "client_error",
39
+ message: "Secret write returned no data",
40
+ },
41
+ stage: "set-secret",
42
+ };
43
+ }
44
+ if (!params.redeploy) {
45
+ return { kind: "ok", result: { secret } };
46
+ }
47
+ const fnResult = await api.getFunction({ id: params.id });
48
+ if (fnResult.error) {
49
+ return {
50
+ kind: "error",
51
+ payload: extractErrorPayload(fnResult.error),
52
+ stage: "get-function",
53
+ };
54
+ }
55
+ const fn = fnResult.data?.data;
56
+ if (!fn) {
57
+ return {
58
+ kind: "error",
59
+ payload: {
60
+ code: "client_error",
61
+ message: "Could not read current function code for redeploy",
62
+ },
63
+ stage: "get-function",
64
+ };
65
+ }
66
+ const updateResult = await api.updateFunction({
67
+ code: fn.code,
68
+ id: params.id,
69
+ });
70
+ if (updateResult.error) {
71
+ return {
72
+ kind: "error",
73
+ payload: extractErrorPayload(updateResult.error),
74
+ stage: "redeploy",
75
+ };
76
+ }
77
+ const redeployed = updateResult.data?.data;
78
+ if (!redeployed) {
79
+ return {
80
+ kind: "error",
81
+ payload: {
82
+ code: "client_error",
83
+ message: "Redeploy returned no data",
84
+ },
85
+ stage: "redeploy",
86
+ };
87
+ }
88
+ return { kind: "ok", result: { redeploy: redeployed, secret } };
89
+ }
90
+ class FunctionsSetSecretCommand extends Command {
91
+ static description = `Write a function secret and optionally redeploy so the new value lands in the running handler. Agent-grade shortcut for functions:set-function-secret + functions:redeploy.
92
+
93
+ Without --redeploy this is a plain secret upsert: the value is
94
+ encrypted at rest but is NOT visible to the running handler until
95
+ the next deploy. Pass --redeploy to re-run the deploy with the
96
+ function's current code in the same call, which refreshes the
97
+ binding set with the value you just wrote.
98
+
99
+ Keys must match \`^[A-Z_][A-Z0-9_]*$\` (uppercase letters, digits,
100
+ underscores; first character is a letter or underscore). System-
101
+ managed keys are reserved and rejected.`;
102
+ static summary = "Write a function secret (optionally redeploying to push it live)";
103
+ static examples = [
104
+ "<%= config.bin %> functions:set-secret --id <fn-id> --key API_TOKEN --value abc123",
105
+ "<%= config.bin %> functions:set-secret --id <fn-id> --key API_TOKEN --value abc123 --redeploy",
106
+ ];
107
+ static flags = {
108
+ "api-key": Flags.string({
109
+ description: "Primitive API key (defaults to PRIMITIVE_API_KEY or saved `primitive login` credentials)",
110
+ env: "PRIMITIVE_API_KEY",
111
+ }),
112
+ "api-base-url-1": Flags.string({
113
+ description: "Override the primary API base URL. Internal testing only; not documented to customers.",
114
+ env: "PRIMITIVE_API_BASE_URL_1",
115
+ hidden: true,
116
+ }),
117
+ "api-base-url-2": Flags.string({
118
+ description: "Override the attachments-supporting send host base URL. Internal testing only; not documented to customers.",
119
+ env: "PRIMITIVE_API_BASE_URL_2",
120
+ hidden: true,
121
+ }),
122
+ id: Flags.string({
123
+ description: "Function id (UUID). The function must already exist.",
124
+ required: true,
125
+ }),
126
+ key: Flags.string({
127
+ description: "Secret key. Uppercase letters, digits, underscores; must start with a letter or underscore. System-managed keys are reserved.",
128
+ required: true,
129
+ }),
130
+ value: Flags.string({
131
+ description: "Secret value (up to 4096 UTF-8 bytes). Encrypted at rest.",
132
+ required: true,
133
+ }),
134
+ redeploy: Flags.boolean({
135
+ description: "Also redeploy the function with its current code so the new value lands in the running handler. Without this, the secret is written but not visible to the handler until the next deploy. Note: source maps are stored only on the runtime side and getFunction does not return them, so this redeploy drops any previously-uploaded source map. If preserving stack-trace symbolication matters, use `functions:redeploy --file <bundle.js> --source-map-file <bundle.js.map>` instead.",
136
+ }),
137
+ time: Flags.boolean({
138
+ description: TIME_FLAG_DESCRIPTION,
139
+ }),
140
+ };
141
+ async run() {
142
+ const { flags } = await this.parse(FunctionsSetSecretCommand);
143
+ await runWithTiming(flags.time, async () => {
144
+ const baseUrlOverridden = flags["api-base-url-1"] !== undefined ||
145
+ flags["api-base-url-2"] !== undefined;
146
+ const auth = resolveCliAuth({
147
+ apiKey: flags["api-key"],
148
+ apiBaseUrl1: flags["api-base-url-1"],
149
+ apiBaseUrl2: flags["api-base-url-2"],
150
+ configDir: this.config.configDir,
151
+ });
152
+ const apiClient = new PrimitiveApiClient({
153
+ apiKey: auth.apiKey,
154
+ apiBaseUrl1: auth.apiBaseUrl1,
155
+ apiBaseUrl2: auth.apiBaseUrl2,
156
+ });
157
+ const authFailureContext = {
158
+ auth,
159
+ baseUrlOverridden,
160
+ configDir: this.config.configDir,
161
+ };
162
+ // Adapter: thin wrappers around the generated SDK calls,
163
+ // routed through host 1 (apiClient.client). The secrets and
164
+ // function-detail endpoints are not on host 2.
165
+ const apiSurface = {
166
+ getFunction: (p) => getFunction({
167
+ client: apiClient.client,
168
+ path: { id: p.id },
169
+ responseStyle: "fields",
170
+ }),
171
+ setSecret: (p) => setFunctionSecret({
172
+ body: { value: p.value },
173
+ client: apiClient.client,
174
+ path: { id: p.id, key: p.key },
175
+ responseStyle: "fields",
176
+ }),
177
+ updateFunction: (p) => updateFunction({
178
+ body: { code: p.code },
179
+ client: apiClient.client,
180
+ path: { id: p.id },
181
+ responseStyle: "fields",
182
+ }),
183
+ };
184
+ const outcome = await runSetSecret(apiSurface, {
185
+ id: flags.id,
186
+ key: flags.key,
187
+ redeploy: flags.redeploy === true,
188
+ value: flags.value,
189
+ });
190
+ if (outcome.kind === "error") {
191
+ // Stage-specific framing on stderr so callers can tell
192
+ // whether the secret landed before a failed redeploy. The
193
+ // JSON envelope still goes through writeErrorWithHints so
194
+ // any actionable hint (e.g. unauthorized) is surfaced.
195
+ if (outcome.stage === "get-function") {
196
+ process.stderr.write("Secret was written, but reading current function code for redeploy failed; the secret is NOT yet live. Re-run with --redeploy, or call `primitive functions:redeploy --id <id> --file <bundle>` once you have the bundle.\n");
197
+ }
198
+ else if (outcome.stage === "redeploy") {
199
+ process.stderr.write("Secret was written, but the redeploy step failed; the secret is NOT yet live. Inspect the function's deploy_error and re-run `primitive functions:redeploy --id <id> --file <bundle>` once the cause is fixed.\n");
200
+ }
201
+ writeErrorWithHints(outcome.payload);
202
+ removeStaleSavedCredentialOnUnauthorized({
203
+ ...authFailureContext,
204
+ payload: outcome.payload,
205
+ });
206
+ process.exitCode = 1;
207
+ return;
208
+ }
209
+ this.log(JSON.stringify(outcome.result, null, 2));
210
+ });
211
+ }
212
+ }
213
+ export default FunctionsSetSecretCommand;
@@ -6,6 +6,7 @@ import EmailsWaitCommand from "./commands/emails-wait.js";
6
6
  import EmailsWatchCommand from "./commands/emails-watch.js";
7
7
  import FunctionsDeployCommand from "./commands/functions-deploy.js";
8
8
  import FunctionsRedeployCommand from "./commands/functions-redeploy.js";
9
+ import FunctionsSetSecretCommand from "./commands/functions-set-secret.js";
9
10
  import LoginCommand from "./commands/login.js";
10
11
  import LogoutCommand from "./commands/logout.js";
11
12
  import SendCommand from "./commands/send.js";
@@ -147,5 +148,12 @@ export const COMMANDS = {
147
148
  // available for callers that want the full surface.
148
149
  "functions:deploy": FunctionsDeployCommand,
149
150
  "functions:redeploy": FunctionsRedeployCommand,
151
+ // `functions:set-secret` is the one-call shortcut for "write a
152
+ // secret AND (optionally) push it live." The raw
153
+ // functions:set-function-secret / functions:create-function-secret
154
+ // operations only do the secret upsert; making the new value
155
+ // visible to the running handler requires a separate redeploy,
156
+ // which this shortcut folds in via --redeploy.
157
+ "functions:set-secret": FunctionsSetSecretCommand,
150
158
  ...generatedCommands,
151
159
  };
@@ -859,6 +859,88 @@
859
859
  "summary": "Redeploy a function from a bundled handler file",
860
860
  "enableJsonFlag": false
861
861
  },
862
+ "functions:set-secret": {
863
+ "aliases": [],
864
+ "args": {},
865
+ "description": "Write a function secret and optionally redeploy so the new value lands in the running handler. Agent-grade shortcut for functions:set-function-secret + functions:redeploy.\n\n Without --redeploy this is a plain secret upsert: the value is\n encrypted at rest but is NOT visible to the running handler until\n the next deploy. Pass --redeploy to re-run the deploy with the\n function's current code in the same call, which refreshes the\n binding set with the value you just wrote.\n\n Keys must match `^[A-Z_][A-Z0-9_]*$` (uppercase letters, digits,\n underscores; first character is a letter or underscore). System-\n managed keys are reserved and rejected.",
866
+ "examples": [
867
+ "<%= config.bin %> functions:set-secret --id <fn-id> --key API_TOKEN --value abc123",
868
+ "<%= config.bin %> functions:set-secret --id <fn-id> --key API_TOKEN --value abc123 --redeploy"
869
+ ],
870
+ "flags": {
871
+ "api-key": {
872
+ "description": "Primitive API key (defaults to PRIMITIVE_API_KEY or saved `primitive login` credentials)",
873
+ "env": "PRIMITIVE_API_KEY",
874
+ "name": "api-key",
875
+ "hasDynamicHelp": false,
876
+ "multiple": false,
877
+ "type": "option"
878
+ },
879
+ "api-base-url-1": {
880
+ "description": "Override the primary API base URL. Internal testing only; not documented to customers.",
881
+ "env": "PRIMITIVE_API_BASE_URL_1",
882
+ "hidden": true,
883
+ "name": "api-base-url-1",
884
+ "hasDynamicHelp": false,
885
+ "multiple": false,
886
+ "type": "option"
887
+ },
888
+ "api-base-url-2": {
889
+ "description": "Override the attachments-supporting send host base URL. Internal testing only; not documented to customers.",
890
+ "env": "PRIMITIVE_API_BASE_URL_2",
891
+ "hidden": true,
892
+ "name": "api-base-url-2",
893
+ "hasDynamicHelp": false,
894
+ "multiple": false,
895
+ "type": "option"
896
+ },
897
+ "id": {
898
+ "description": "Function id (UUID). The function must already exist.",
899
+ "name": "id",
900
+ "required": true,
901
+ "hasDynamicHelp": false,
902
+ "multiple": false,
903
+ "type": "option"
904
+ },
905
+ "key": {
906
+ "description": "Secret key. Uppercase letters, digits, underscores; must start with a letter or underscore. System-managed keys are reserved.",
907
+ "name": "key",
908
+ "required": true,
909
+ "hasDynamicHelp": false,
910
+ "multiple": false,
911
+ "type": "option"
912
+ },
913
+ "value": {
914
+ "description": "Secret value (up to 4096 UTF-8 bytes). Encrypted at rest.",
915
+ "name": "value",
916
+ "required": true,
917
+ "hasDynamicHelp": false,
918
+ "multiple": false,
919
+ "type": "option"
920
+ },
921
+ "redeploy": {
922
+ "description": "Also redeploy the function with its current code so the new value lands in the running handler. Without this, the secret is written but not visible to the handler until the next deploy. Note: source maps are stored only on the runtime side and getFunction does not return them, so this redeploy drops any previously-uploaded source map. If preserving stack-trace symbolication matters, use `functions:redeploy --file <bundle.js> --source-map-file <bundle.js.map>` instead.",
923
+ "name": "redeploy",
924
+ "allowNo": false,
925
+ "type": "boolean"
926
+ },
927
+ "time": {
928
+ "description": "Print the wall-clock duration of this command to stderr after it completes (e.g. `[time: 1.34s]`). Useful for measuring `--wait` send latency, comparing CLI overhead, or capturing timing in scripts.",
929
+ "name": "time",
930
+ "allowNo": false,
931
+ "type": "boolean"
932
+ }
933
+ },
934
+ "hasDynamicHelp": false,
935
+ "hiddenAliases": [],
936
+ "id": "functions:set-secret",
937
+ "pluginAlias": "@primitivedotdev/sdk",
938
+ "pluginName": "@primitivedotdev/sdk",
939
+ "pluginType": "core",
940
+ "strict": true,
941
+ "summary": "Write a function secret (optionally redeploying to push it live)",
942
+ "enableJsonFlag": false
943
+ },
862
944
  "account:get-account": {
863
945
  "aliases": [],
864
946
  "args": {},
@@ -2918,7 +3000,7 @@
2918
3000
  "functions:create-function": {
2919
3001
  "aliases": [],
2920
3002
  "args": {},
2921
- "description": "Creates and deploys a new function. The handler must be a single\nESM module that exports a default async function receiving the\n`email.received` event (see the Webhook payload section for the\nfull schema). Code is bundled before being uploaded; ship a\nsingle self-contained file rather than relying on external\nimports.\n\n**Code limits.** `code` is capped at 1 MiB UTF-8. `sourceMap`\n(optional) is capped at 5 MiB UTF-8 and is stored only on the\nedge runtime side; it is not persisted in Primitive's database.\n\n**Auto-wiring.** On successful deploy, Primitive automatically\ncreates a webhook endpoint that delivers inbound mail to the\nfunction. There is nothing to configure on the Endpoints API\nfor this to work; the gateway URL returned here is for\nreference only and is not directly callable from outside.\n\n**Secrets.** New functions ship with the managed secrets\n(`PRIMITIVE_WEBHOOK_SECRET`, `PRIMITIVE_API_KEY`) already\nbound. Add user-set secrets via\n`POST /functions/{id}/secrets`; secret writes only land in the\nrunning handler on the next redeploy.\n",
3003
+ "description": "Creates and deploys a new function. The handler must be a single\nESM module that exports a default async function receiving the\n`email.received` event (see the Webhook payload section for the\nfull schema). Code is bundled before being uploaded; ship a\nsingle self-contained file rather than relying on external\nimports.\n\n**Code limits.** `code` is capped at 1 MiB UTF-8. `sourceMap`\n(optional) is capped at 5 MiB UTF-8 and is stored only on the\nedge runtime side; it is not persisted in Primitive's database.\n\n**Auto-wiring.** On successful deploy, Primitive automatically\ncreates a webhook endpoint that delivers inbound mail to the\nfunction. There is nothing to configure on the Endpoints API\nfor this to work; the gateway URL returned here is for\nreference only and is not directly callable from outside.\n\n**Secrets.** New functions ship with the managed secrets\n(`PRIMITIVE_WEBHOOK_SECRET`, `PRIMITIVE_API_KEY`) already\nbound. Add user-set secrets via\n`POST /functions/{id}/secrets`; secret writes only land in the\nrunning handler on the next redeploy.\n\n\nTip: prefer `primitive functions:deploy --name <name> --file <bundle>` for file-input ergonomics. This raw command exists for callers passing JSON.",
2922
3004
  "flags": {
2923
3005
  "api-key": {
2924
3006
  "description": "Primitive API key (defaults to PRIMITIVE_API_KEY or saved `primitive login` credentials)",
@@ -3001,7 +3083,7 @@
3001
3083
  "functions:create-function-secret": {
3002
3084
  "aliases": [],
3003
3085
  "args": {},
3004
- "description": "Idempotent insert-or-update keyed on `(function_id, key)`.\nReturns 201 the first time the key is set, 200 on subsequent\nupdates. Values are encrypted at rest and only become visible\nto the running handler on the next deploy (`PUT /functions/{id}`\nwith the existing code is sufficient to refresh bindings).\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",
3086
+ "description": "Idempotent insert-or-update keyed on `(function_id, key)`.\nReturns 201 the first time the key is set, 200 on subsequent\nupdates. Values are encrypted at rest and only become visible\nto the running handler on the next deploy (`PUT /functions/{id}`\nwith the existing code is sufficient to refresh bindings).\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\n\nTip: prefer `primitive functions:set-secret --id <id> --key <KEY> --value <value> [--redeploy]` for secret writes that also push the binding live. This raw command exists for callers passing JSON.",
3005
3087
  "flags": {
3006
3088
  "api-key": {
3007
3089
  "description": "Primitive API key (defaults to PRIMITIVE_API_KEY or saved `primitive login` credentials)",
@@ -3365,7 +3447,7 @@
3365
3447
  "functions:set-function-secret": {
3366
3448
  "aliases": [],
3367
3449
  "args": {},
3368
- "description": "Path-keyed companion to `POST /functions/{id}/secrets`.\nIdempotent: returns 201 the first time the key is set, 200 on\nsubsequent updates. Same validation rules and same write-only\nguarantees as the POST verb; the new value lands in the running\nhandler on the next deploy.\n",
3450
+ "description": "Path-keyed companion to `POST /functions/{id}/secrets`.\nIdempotent: returns 201 the first time the key is set, 200 on\nsubsequent updates. Same validation rules and same write-only\nguarantees as the POST verb; the new value lands in the running\nhandler on the next deploy.\n\n\nTip: prefer `primitive functions:set-secret --id <id> --key <KEY> --value <value> [--redeploy]` for secret writes that also push the binding live. This raw command exists for callers passing JSON.",
3369
3451
  "flags": {
3370
3452
  "api-key": {
3371
3453
  "description": "Primitive API key (defaults to PRIMITIVE_API_KEY or saved `primitive login` credentials)",
@@ -3506,7 +3588,7 @@
3506
3588
  "functions:update-function": {
3507
3589
  "aliases": [],
3508
3590
  "args": {},
3509
- "description": "Replaces the function's source code with the body's `code` and\ntriggers a redeploy. Same size limits as `POST /functions`.\nUse this verb to push secret writes into the running handler:\npassing the same `code` re-runs the deploy and refreshes the\nbinding set with the latest values from the secrets table.\n\nOn a 502 deploy failure, the previously-deployed code stays\nlive; the runtime never serves a half-built bundle. The\n`deploy_error` field on the returned record carries the error\nthat came back from the runtime so you can surface it to users\nwithout polling.\n",
3591
+ "description": "Replaces the function's source code with the body's `code` and\ntriggers a redeploy. Same size limits as `POST /functions`.\nUse this verb to push secret writes into the running handler:\npassing the same `code` re-runs the deploy and refreshes the\nbinding set with the latest values from the secrets table.\n\nOn a 502 deploy failure, the previously-deployed code stays\nlive; the runtime never serves a half-built bundle. The\n`deploy_error` field on the returned record carries the error\nthat came back from the runtime so you can surface it to users\nwithout polling.\n\n\nTip: prefer `primitive functions:redeploy --id <id> --file <bundle>` for file-input ergonomics. This raw command exists for callers passing JSON.",
3510
3592
  "flags": {
3511
3593
  "api-key": {
3512
3594
  "description": "Primitive API key (defaults to PRIMITIVE_API_KEY or saved `primitive login` credentials)",
@@ -4168,5 +4250,5 @@
4168
4250
  "enableJsonFlag": false
4169
4251
  }
4170
4252
  },
4171
- "version": "0.21.0"
4253
+ "version": "0.22.0"
4172
4254
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primitivedotdev/sdk",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "description": "Official Primitive Node.js SDK: webhook, api, openapi, contract, and parser modules",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
@@ -84,7 +84,7 @@
84
84
  "description": "View and replay webhook delivery attempts"
85
85
  },
86
86
  "functions": {
87
- "description": "Deploy JavaScript handlers that run on inbound mail. Use `primitive functions:deploy --name <name> --file <bundle.js>` for the file-input ergonomic, or `functions:create-function` / `functions:update-function` for the full body-string surface."
87
+ "description": "Deploy JavaScript handlers that run on inbound mail. Use `primitive functions:deploy --name <name> --file <bundle.js>` to create, `primitive functions:redeploy --id <id> --file <bundle.js>` to push a new bundle, and `primitive functions:set-secret --id <id> --key <KEY> --value <value> [--redeploy]` to write a secret (with optional one-call redeploy so the value lands in the running handler). The auto-generated functions:create-function / functions:update-function / functions:create-function-secret / functions:set-function-secret operations stay available for the full body-string surface."
88
88
  }
89
89
  },
90
90
  "topicSeparator": " "