@primitivedotdev/cli 1.4.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.
Files changed (2) hide show
  1. package/dist/oclif/index.js +451 -2
  2. package/package.json +1 -1
@@ -32,12 +32,14 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
32
32
  createFilter: () => createFilter,
33
33
  createFunction: () => createFunction,
34
34
  createFunctionSecret: () => createFunctionSecret,
35
+ createOrgSecret: () => createOrgSecret,
35
36
  deleteDomain: () => deleteDomain,
36
37
  deleteEmail: () => deleteEmail,
37
38
  deleteEndpoint: () => deleteEndpoint,
38
39
  deleteFilter: () => deleteFilter,
39
40
  deleteFunction: () => deleteFunction,
40
41
  deleteFunctionSecret: () => deleteFunctionSecret,
42
+ deleteOrgSecret: () => deleteOrgSecret,
41
43
  discardEmailContent: () => discardEmailContent,
42
44
  downloadAttachments: () => downloadAttachments,
43
45
  downloadDomainZoneFile: () => downloadDomainZoneFile,
@@ -63,6 +65,7 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
63
65
  listFunctionLogs: () => listFunctionLogs,
64
66
  listFunctionSecrets: () => listFunctionSecrets,
65
67
  listFunctions: () => listFunctions,
68
+ listOrgSecrets: () => listOrgSecrets,
66
69
  listSentEmails: () => listSentEmails,
67
70
  pollCliLogin: () => pollCliLogin,
68
71
  replayDelivery: () => replayDelivery,
@@ -76,6 +79,7 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
76
79
  sendEmail: () => sendEmail,
77
80
  setFunctionRoute: () => setFunctionRoute,
78
81
  setFunctionSecret: () => setFunctionSecret,
82
+ setOrgSecret: () => setOrgSecret,
79
83
  startAgentClaim: () => startAgentClaim,
80
84
  startAgentSignup: () => startAgentSignup,
81
85
  startCliLogin: () => startCliLogin,
@@ -1517,6 +1521,85 @@ const setFunctionSecret = (options) => (options.client ?? client).put({
1517
1521
  }
1518
1522
  });
1519
1523
  /**
1524
+ * List org-level (global) secrets
1525
+ *
1526
+ * Returns metadata for every org-level secret. Org secrets apply
1527
+ * to every function in the org and are read as `env.<KEY>` in
1528
+ * handlers. **Values are never returned.** Secret writes are
1529
+ * write-only. A function-level secret of the same name overrides
1530
+ * the org-level value for that function.
1531
+ *
1532
+ */
1533
+ const listOrgSecrets = (options) => (options?.client ?? client).get({
1534
+ security: [{
1535
+ scheme: "bearer",
1536
+ type: "http"
1537
+ }],
1538
+ url: "/org/secrets",
1539
+ ...options
1540
+ });
1541
+ /**
1542
+ * Create or update an org secret
1543
+ *
1544
+ * Idempotent insert-or-update keyed on `(org_id, key)`. Returns
1545
+ * 201 the first time the key is set, 200 on subsequent updates.
1546
+ * Values are encrypted at rest. A changed value lands in a
1547
+ * function only on that function's next deploy.
1548
+ *
1549
+ * Keys must match `^[A-Z_][A-Z0-9_]*$` (uppercase letters,
1550
+ * digits, underscores; first character is a letter or
1551
+ * underscore). Values are at most 4096 UTF-8 bytes. System-
1552
+ * managed keys are reserved and rejected.
1553
+ *
1554
+ */
1555
+ const createOrgSecret = (options) => (options.client ?? client).post({
1556
+ security: [{
1557
+ scheme: "bearer",
1558
+ type: "http"
1559
+ }],
1560
+ url: "/org/secrets",
1561
+ ...options,
1562
+ headers: {
1563
+ ...options.body !== void 0 && { "Content-Type": "application/json" },
1564
+ ...options.headers
1565
+ }
1566
+ });
1567
+ /**
1568
+ * Delete an org secret
1569
+ *
1570
+ * Removes the org secret. Functions keep the previous value until
1571
+ * each is redeployed. Returns 404 if the key did not exist.
1572
+ *
1573
+ */
1574
+ const deleteOrgSecret = (options) => (options.client ?? client).delete({
1575
+ security: [{
1576
+ scheme: "bearer",
1577
+ type: "http"
1578
+ }],
1579
+ url: "/org/secrets/{key}",
1580
+ ...options
1581
+ });
1582
+ /**
1583
+ * Set an org secret by key
1584
+ *
1585
+ * Path-keyed companion to `POST /org/secrets`. Idempotent:
1586
+ * returns 201 the first time the key is set, 200 on subsequent
1587
+ * updates. Same validation and write-only guarantees as POST.
1588
+ *
1589
+ */
1590
+ const setOrgSecret = (options) => (options.client ?? client).put({
1591
+ security: [{
1592
+ scheme: "bearer",
1593
+ type: "http"
1594
+ }],
1595
+ url: "/org/secrets/{key}",
1596
+ ...options,
1597
+ headers: {
1598
+ ...options.body !== void 0 && { "Content-Type": "application/json" },
1599
+ ...options.headers
1600
+ }
1601
+ });
1602
+ /**
1520
1603
  * List a function's execution logs
1521
1604
  *
1522
1605
  * Returns the most recent `function_logs` rows for the function,
@@ -3709,6 +3792,111 @@ const openapiDocument = {
3709
3792
  }
3710
3793
  }
3711
3794
  },
3795
+ "/org/secrets": {
3796
+ "get": {
3797
+ "operationId": "listOrgSecrets",
3798
+ "summary": "List org-level (global) secrets",
3799
+ "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",
3800
+ "tags": ["Functions"],
3801
+ "responses": {
3802
+ "200": {
3803
+ "description": "List of org secrets (metadata only, no values)",
3804
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, {
3805
+ "type": "object",
3806
+ "properties": { "data": {
3807
+ "type": "object",
3808
+ "properties": { "items": {
3809
+ "type": "array",
3810
+ "items": { "$ref": "#/components/schemas/OrgSecretListItem" }
3811
+ } },
3812
+ "required": ["items"]
3813
+ } }
3814
+ }] } } }
3815
+ },
3816
+ "401": { "$ref": "#/components/responses/Unauthorized" }
3817
+ }
3818
+ },
3819
+ "post": {
3820
+ "operationId": "createOrgSecret",
3821
+ "summary": "Create or update an org secret",
3822
+ "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",
3823
+ "tags": ["Functions"],
3824
+ "requestBody": {
3825
+ "required": true,
3826
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateOrgSecretInput" } } }
3827
+ },
3828
+ "responses": {
3829
+ "200": {
3830
+ "description": "Secret updated",
3831
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, {
3832
+ "type": "object",
3833
+ "properties": { "data": { "$ref": "#/components/schemas/OrgSecretWriteResult" } }
3834
+ }] } } }
3835
+ },
3836
+ "201": {
3837
+ "description": "Secret created",
3838
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, {
3839
+ "type": "object",
3840
+ "properties": { "data": { "$ref": "#/components/schemas/OrgSecretWriteResult" } }
3841
+ }] } } }
3842
+ },
3843
+ "400": { "$ref": "#/components/responses/ValidationError" },
3844
+ "401": { "$ref": "#/components/responses/Unauthorized" }
3845
+ }
3846
+ }
3847
+ },
3848
+ "/org/secrets/{key}": {
3849
+ "parameters": [{
3850
+ "name": "key",
3851
+ "in": "path",
3852
+ "required": true,
3853
+ "description": "Secret key. Must match `^[A-Z_][A-Z0-9_]*$`.",
3854
+ "schema": {
3855
+ "type": "string",
3856
+ "pattern": "^[A-Z_][A-Z0-9_]*$"
3857
+ }
3858
+ }],
3859
+ "put": {
3860
+ "operationId": "setOrgSecret",
3861
+ "summary": "Set an org secret by key",
3862
+ "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",
3863
+ "tags": ["Functions"],
3864
+ "requestBody": {
3865
+ "required": true,
3866
+ "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SetOrgSecretInput" } } }
3867
+ },
3868
+ "responses": {
3869
+ "200": {
3870
+ "description": "Secret updated",
3871
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, {
3872
+ "type": "object",
3873
+ "properties": { "data": { "$ref": "#/components/schemas/OrgSecretWriteResult" } }
3874
+ }] } } }
3875
+ },
3876
+ "201": {
3877
+ "description": "Secret created",
3878
+ "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, {
3879
+ "type": "object",
3880
+ "properties": { "data": { "$ref": "#/components/schemas/OrgSecretWriteResult" } }
3881
+ }] } } }
3882
+ },
3883
+ "400": { "$ref": "#/components/responses/ValidationError" },
3884
+ "401": { "$ref": "#/components/responses/Unauthorized" }
3885
+ }
3886
+ },
3887
+ "delete": {
3888
+ "operationId": "deleteOrgSecret",
3889
+ "summary": "Delete an org secret",
3890
+ "description": "Removes the org secret. Functions keep the previous value until\neach is redeployed. Returns 404 if the key did not exist.\n",
3891
+ "tags": ["Functions"],
3892
+ "responses": {
3893
+ "204": { "description": "Secret deleted" },
3894
+ "400": { "$ref": "#/components/responses/ValidationError" },
3895
+ "401": { "$ref": "#/components/responses/Unauthorized" },
3896
+ "404": { "$ref": "#/components/responses/NotFound" }
3897
+ }
3898
+ }
3899
+ },
3712
3900
  "/functions/{id}/logs": {
3713
3901
  "parameters": [{ "$ref": "#/components/parameters/ResourceId" }],
3714
3902
  "get": {
@@ -7920,6 +8108,81 @@ const openapiDocument = {
7920
8108
  "updated_at",
7921
8109
  "created"
7922
8110
  ]
8111
+ },
8112
+ "OrgSecretListItem": {
8113
+ "type": "object",
8114
+ "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",
8115
+ "properties": {
8116
+ "key": { "type": "string" },
8117
+ "created_at": {
8118
+ "type": "string",
8119
+ "format": "date-time"
8120
+ },
8121
+ "updated_at": {
8122
+ "type": "string",
8123
+ "format": "date-time"
8124
+ }
8125
+ },
8126
+ "required": [
8127
+ "key",
8128
+ "created_at",
8129
+ "updated_at"
8130
+ ]
8131
+ },
8132
+ "CreateOrgSecretInput": {
8133
+ "type": "object",
8134
+ "additionalProperties": false,
8135
+ "description": "Body for POST /org/secrets.",
8136
+ "properties": {
8137
+ "key": {
8138
+ "type": "string",
8139
+ "pattern": "^[A-Z_][A-Z0-9_]*$",
8140
+ "description": "Uppercase letters, digits, and underscores. Must start with\na letter or underscore. System-managed keys are reserved.\n"
8141
+ },
8142
+ "value": {
8143
+ "type": "string",
8144
+ "minLength": 1,
8145
+ "maxLength": 4096,
8146
+ "description": "Secret value, up to 4096 UTF-8 bytes. Encrypted at rest.\nNever returned by any read endpoint.\n"
8147
+ }
8148
+ },
8149
+ "required": ["key", "value"]
8150
+ },
8151
+ "SetOrgSecretInput": {
8152
+ "type": "object",
8153
+ "additionalProperties": false,
8154
+ "description": "Body for PUT /org/secrets/{key}. Key comes from the path.",
8155
+ "properties": { "value": {
8156
+ "type": "string",
8157
+ "minLength": 1,
8158
+ "maxLength": 4096
8159
+ } },
8160
+ "required": ["value"]
8161
+ },
8162
+ "OrgSecretWriteResult": {
8163
+ "type": "object",
8164
+ "description": "Returned by POST and PUT org secret routes.",
8165
+ "properties": {
8166
+ "key": { "type": "string" },
8167
+ "created_at": {
8168
+ "type": "string",
8169
+ "format": "date-time"
8170
+ },
8171
+ "updated_at": {
8172
+ "type": "string",
8173
+ "format": "date-time"
8174
+ },
8175
+ "created": {
8176
+ "type": "boolean",
8177
+ "description": "True if this call inserted a new row, false if it updated an existing one."
8178
+ }
8179
+ },
8180
+ "required": [
8181
+ "key",
8182
+ "created_at",
8183
+ "updated_at",
8184
+ "created"
8185
+ ]
7923
8186
  }
7924
8187
  }
7925
8188
  }
@@ -11624,6 +11887,66 @@ const operationManifest = [
11624
11887
  "tag": "Functions",
11625
11888
  "tagCommand": "functions"
11626
11889
  },
11890
+ {
11891
+ "binaryResponse": false,
11892
+ "bodyRequired": true,
11893
+ "command": "create-org-secret",
11894
+ "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",
11895
+ "hasJsonBody": true,
11896
+ "method": "POST",
11897
+ "operationId": "createOrgSecret",
11898
+ "path": "/org/secrets",
11899
+ "pathParams": [],
11900
+ "queryParams": [],
11901
+ "requestSchema": {
11902
+ "type": "object",
11903
+ "additionalProperties": false,
11904
+ "description": "Body for POST /org/secrets.",
11905
+ "properties": {
11906
+ "key": {
11907
+ "type": "string",
11908
+ "pattern": "^[A-Z_][A-Z0-9_]*$",
11909
+ "description": "Uppercase letters, digits, and underscores. Must start with\na letter or underscore. System-managed keys are reserved.\n"
11910
+ },
11911
+ "value": {
11912
+ "type": "string",
11913
+ "minLength": 1,
11914
+ "maxLength": 4096,
11915
+ "description": "Secret value, up to 4096 UTF-8 bytes. Encrypted at rest.\nNever returned by any read endpoint.\n"
11916
+ }
11917
+ },
11918
+ "required": ["key", "value"]
11919
+ },
11920
+ "responseSchema": {
11921
+ "type": "object",
11922
+ "description": "Returned by POST and PUT org secret routes.",
11923
+ "properties": {
11924
+ "key": { "type": "string" },
11925
+ "created_at": {
11926
+ "type": "string",
11927
+ "format": "date-time"
11928
+ },
11929
+ "updated_at": {
11930
+ "type": "string",
11931
+ "format": "date-time"
11932
+ },
11933
+ "created": {
11934
+ "type": "boolean",
11935
+ "description": "True if this call inserted a new row, false if it updated an existing one."
11936
+ }
11937
+ },
11938
+ "required": [
11939
+ "key",
11940
+ "created_at",
11941
+ "updated_at",
11942
+ "created"
11943
+ ]
11944
+ },
11945
+ "sdkName": "createOrgSecret",
11946
+ "summary": "Create or update an org secret",
11947
+ "tag": "Functions",
11948
+ "tagCommand": "functions"
11949
+ },
11627
11950
  {
11628
11951
  "binaryResponse": false,
11629
11952
  "bodyRequired": false,
@@ -11678,6 +12001,30 @@ const operationManifest = [
11678
12001
  "tag": "Functions",
11679
12002
  "tagCommand": "functions"
11680
12003
  },
12004
+ {
12005
+ "binaryResponse": false,
12006
+ "bodyRequired": false,
12007
+ "command": "delete-org-secret",
12008
+ "description": "Removes the org secret. Functions keep the previous value until\neach is redeployed. Returns 404 if the key did not exist.\n",
12009
+ "hasJsonBody": false,
12010
+ "method": "DELETE",
12011
+ "operationId": "deleteOrgSecret",
12012
+ "path": "/org/secrets/{key}",
12013
+ "pathParams": [{
12014
+ "description": "Secret key. Must match `^[A-Z_][A-Z0-9_]*$`.",
12015
+ "enum": null,
12016
+ "name": "key",
12017
+ "required": true,
12018
+ "type": "string"
12019
+ }],
12020
+ "queryParams": [],
12021
+ "requestSchema": null,
12022
+ "responseSchema": null,
12023
+ "sdkName": "deleteOrgSecret",
12024
+ "summary": "Delete an org secret",
12025
+ "tag": "Functions",
12026
+ "tagCommand": "functions"
12027
+ },
11681
12028
  {
11682
12029
  "binaryResponse": false,
11683
12030
  "bodyRequired": false,
@@ -12558,6 +12905,50 @@ const operationManifest = [
12558
12905
  "tag": "Functions",
12559
12906
  "tagCommand": "functions"
12560
12907
  },
12908
+ {
12909
+ "binaryResponse": false,
12910
+ "bodyRequired": false,
12911
+ "command": "list-org-secrets",
12912
+ "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",
12913
+ "hasJsonBody": false,
12914
+ "method": "GET",
12915
+ "operationId": "listOrgSecrets",
12916
+ "path": "/org/secrets",
12917
+ "pathParams": [],
12918
+ "queryParams": [],
12919
+ "requestSchema": null,
12920
+ "responseSchema": {
12921
+ "type": "object",
12922
+ "properties": { "items": {
12923
+ "type": "array",
12924
+ "items": {
12925
+ "type": "object",
12926
+ "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",
12927
+ "properties": {
12928
+ "key": { "type": "string" },
12929
+ "created_at": {
12930
+ "type": "string",
12931
+ "format": "date-time"
12932
+ },
12933
+ "updated_at": {
12934
+ "type": "string",
12935
+ "format": "date-time"
12936
+ }
12937
+ },
12938
+ "required": [
12939
+ "key",
12940
+ "created_at",
12941
+ "updated_at"
12942
+ ]
12943
+ }
12944
+ } },
12945
+ "required": ["items"]
12946
+ },
12947
+ "sdkName": "listOrgSecrets",
12948
+ "summary": "List org-level (global) secrets",
12949
+ "tag": "Functions",
12950
+ "tagCommand": "functions"
12951
+ },
12561
12952
  {
12562
12953
  "binaryResponse": false,
12563
12954
  "bodyRequired": true,
@@ -12746,6 +13137,64 @@ const operationManifest = [
12746
13137
  "tag": "Functions",
12747
13138
  "tagCommand": "functions"
12748
13139
  },
13140
+ {
13141
+ "binaryResponse": false,
13142
+ "bodyRequired": true,
13143
+ "command": "set-org-secret",
13144
+ "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",
13145
+ "hasJsonBody": true,
13146
+ "method": "PUT",
13147
+ "operationId": "setOrgSecret",
13148
+ "path": "/org/secrets/{key}",
13149
+ "pathParams": [{
13150
+ "description": "Secret key. Must match `^[A-Z_][A-Z0-9_]*$`.",
13151
+ "enum": null,
13152
+ "name": "key",
13153
+ "required": true,
13154
+ "type": "string"
13155
+ }],
13156
+ "queryParams": [],
13157
+ "requestSchema": {
13158
+ "type": "object",
13159
+ "additionalProperties": false,
13160
+ "description": "Body for PUT /org/secrets/{key}. Key comes from the path.",
13161
+ "properties": { "value": {
13162
+ "type": "string",
13163
+ "minLength": 1,
13164
+ "maxLength": 4096
13165
+ } },
13166
+ "required": ["value"]
13167
+ },
13168
+ "responseSchema": {
13169
+ "type": "object",
13170
+ "description": "Returned by POST and PUT org secret routes.",
13171
+ "properties": {
13172
+ "key": { "type": "string" },
13173
+ "created_at": {
13174
+ "type": "string",
13175
+ "format": "date-time"
13176
+ },
13177
+ "updated_at": {
13178
+ "type": "string",
13179
+ "format": "date-time"
13180
+ },
13181
+ "created": {
13182
+ "type": "boolean",
13183
+ "description": "True if this call inserted a new row, false if it updated an existing one."
13184
+ }
13185
+ },
13186
+ "required": [
13187
+ "key",
13188
+ "created_at",
13189
+ "updated_at",
13190
+ "created"
13191
+ ]
13192
+ },
13193
+ "sdkName": "setOrgSecret",
13194
+ "summary": "Set an org secret by key",
13195
+ "tag": "Functions",
13196
+ "tagCommand": "functions"
13197
+ },
12749
13198
  {
12750
13199
  "binaryResponse": false,
12751
13200
  "bodyRequired": false,
@@ -18933,8 +19382,8 @@ const PRIMITIVE_TEAM_AUTHOR = {
18933
19382
  name: "Primitive Team",
18934
19383
  url: "https://primitive.dev"
18935
19384
  };
18936
- const SDK_VERSION_RANGE = "^1.4.0";
18937
- const CLI_VERSION_RANGE = "^1.4.0";
19385
+ const SDK_VERSION_RANGE = "^1.5.0";
19386
+ const CLI_VERSION_RANGE = "^1.5.0";
18938
19387
  const ESBUILD_VERSION_RANGE = "^0.27.0";
18939
19388
  function renderHandler() {
18940
19389
  return `// env.PRIMITIVE_API_KEY, env.PRIMITIVE_WEBHOOK_SECRET, and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primitivedotdev/cli",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Official Primitive CLI: deploy Primitive Functions, send and inspect mail, manage endpoints, all from the terminal. Wraps the @primitivedotdev/sdk runtime client with one-shot commands.",
5
5
  "type": "module",
6
6
  "sideEffects": false,