@foir/cli 0.77.0 → 0.78.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.
@@ -704,14 +704,30 @@ interface ApplyConfigHookInput {
704
704
  interface ApplyConfigApiKeyInput {
705
705
  /** Name for this API key (e.g. "Tilly iOS", "Tilly CRM sync"). */
706
706
  name: string;
707
- /** Key type: 'public' for your app, 'secret' for a third-party client's own server. */
708
- keyType: 'public' | 'secret';
707
+ /**
708
+ * What the key is for. You choose it, and the platform holds the key to what
709
+ * that kind may hold and give:
710
+ *
711
+ * - `'publishable'` sits in a web page or an app, where anyone can read it.
712
+ * It gives a visitor only what is safe to give everyone.
713
+ * - `'server'` is held by the server that renders your pages. It is a
714
+ * publishable key that may also say who and where its visitor is
715
+ * (`visitors:forward`), and it never goes to a browser.
716
+ * - `'admin'` is a machine's own: a sync job, a pipeline, a tool. It does
717
+ * what it holds, gives nobody anything, and nobody signs in through it.
718
+ * It expires.
719
+ *
720
+ * A key's kind never changes. A config that declares another kind for a key
721
+ * that already exists is refused: declare a new key under a new name.
722
+ */
723
+ kind: 'publishable' | 'server' | 'admin';
709
724
  /** Environment variable name to write the key to in .env (e.g. "FOIR_PUBLIC_KEY"). */
710
725
  envVar: string;
711
726
  /**
712
- * What the key holds: the most anyone may do through it, in the permission
713
- * catalogue's names (e.g. ["records:read", "records:write"]). A secret key
714
- * may hold ["*"].
727
+ * What the key holds, in the permission catalogue's names (e.g.
728
+ * ["records:read", "records:write"]): for a publishable or a server key the
729
+ * most a signed-in user may do through it, and for an admin key what it
730
+ * does. An admin key may hold ["*"].
715
731
  *
716
732
  * Declared for every key. Nothing is filled in, so a key declared without
717
733
  * it would be minted holding nothing, and a push refuses one.
@@ -721,13 +737,14 @@ interface ApplyConfigApiKeyInput {
721
737
  */
722
738
  grants: string[];
723
739
  /**
724
- * What the key gives whoever comes through it, in the same names: a visitor
725
- * with no sign-in, on a public key, and a signed-in user beneath their role,
726
- * on either kind.
740
+ * What a publishable or a server key gives whoever comes through it, in the
741
+ * same names: a visitor with no sign-in, and a signed-in user beneath their
742
+ * role. An admin key gives nobody anything, and one declared with this list
743
+ * is refused.
727
744
  *
728
745
  * NOTHING IS FILLED IN. A key declared without this list gives a visitor
729
- * nothing, whatever it holds: a public key holding `records:read` and no
730
- * list here is a key no visitor can read with. Name each read a visitor
746
+ * nothing, whatever it holds: a publishable key holding `records:read` and
747
+ * no list here is a key no visitor can read with. Name each read a visitor
731
748
  * needs. A visitor may also be given one model to submit into
732
749
  * (`records:create:<model>`) and one operation to run
733
750
  * (`operations:execute:<operation>`), each naming something this config
@@ -737,6 +754,17 @@ interface ApplyConfigApiKeyInput {
737
754
  * place. Left out, a push leaves what the key gives as it is.
738
755
  */
739
756
  baselineGrants?: string[];
757
+ /**
758
+ * An admin key only: how long it lives from the push that makes it, in days
759
+ * (e.g. "90d", which is what it is given when nothing is said, up to
760
+ * "365d"). A publishable or a server key never expires, and one declared
761
+ * with this is refused.
762
+ *
763
+ * It is read when the key is made. A push never renews a key that exists:
764
+ * renew it with `foir api-keys renew`, so that a key is kept alive by
765
+ * somebody deciding to and not by a pipeline that happens to run.
766
+ */
767
+ expiresIn?: string;
740
768
  /** Restrict the key to specific model keys (e.g. ["tilly_note", "tilly_block"]). */
741
769
  allowedModels?: string[];
742
770
  /** Restrict file uploads: a MIME type ("image/png"), a whole type ("image/*"), or IMAGE, VIDEO, FILE. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foir/cli",
3
- "version": "0.77.0",
3
+ "version": "0.78.0",
4
4
  "description": "Universal platform CLI for Foir platform",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -65,7 +65,7 @@
65
65
  "@foir/assistant": "0.0.0",
66
66
  "@foir/proto-ts": "0.109.0",
67
67
  "@foir/rpc-node": "0.0.0",
68
- "@foir/sdk": "0.20.0",
68
+ "@foir/sdk": "0.21.0",
69
69
  "@foir/console-routes": "0.0.0"
70
70
  },
71
71
  "engines": {