@teable/app 6.1.2 → 6.1.4

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/build/cli.js CHANGED
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  buildServer,
4
4
  buildWorker
5
- } from "../chunks/V7ENYEWD.js";
6
- import "../chunks/WKI563UT.js";
5
+ } from "../chunks/H3YCXVRL.js";
6
+ import "../chunks/RJHLCJUX.js";
7
7
 
8
8
  // src/build/cli.ts
9
9
  import { mkdirSync, rmSync, writeFileSync } from "node:fs";
@@ -3,8 +3,8 @@ import {
3
3
  buildWorker,
4
4
  sqlAsText,
5
5
  teable
6
- } from "../chunks/V7ENYEWD.js";
7
- import "../chunks/WKI563UT.js";
6
+ } from "../chunks/H3YCXVRL.js";
7
+ import "../chunks/RJHLCJUX.js";
8
8
  export {
9
9
  buildServer,
10
10
  buildWorker,
@@ -6,7 +6,7 @@ import {
6
6
  PAGES_APP_META,
7
7
  SESSION_PATH,
8
8
  checkAccess
9
- } from "./WKI563UT.js";
9
+ } from "./RJHLCJUX.js";
10
10
 
11
11
  // src/build/index.ts
12
12
  import { existsSync, readFileSync } from "node:fs";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  describeTables
3
- } from "./NOOZYN7X.js";
3
+ } from "./TN5GZDH5.js";
4
4
  import {
5
5
  CAPABILITIES,
6
6
  PROTOCOL_VERSION,
7
7
  admit,
8
8
  isPageAccess
9
- } from "./WKI563UT.js";
9
+ } from "./RJHLCJUX.js";
10
10
 
11
11
  // src/server/errors.ts
12
12
  import { z } from "zod";
@@ -78,6 +78,15 @@ function fileKeyPath(key) {
78
78
  var DEPLOY_HEADERS = { commit: "X-Teable-Commit", message: "X-Teable-Message" };
79
79
  var DEPLOY_PARTS = { server: "server", worker: "worker", pages: "pages" };
80
80
  var PAGES_APP_META = "teable-app";
81
+ var SECRET_NAME_PATTERN = "[A-Z][A-Z0-9_]{0,63}";
82
+ var SECRET_NAME = new RegExp(`^${SECRET_NAME_PATTERN}$`);
83
+ function secretPlaceholder(name) {
84
+ return `{{secret:${name}}}`;
85
+ }
86
+ var SECRET_PLACEHOLDER = new RegExp(
87
+ `(?:\\{\\{|%7[Bb]%7[Bb])secret(?::|%3[Aa])(${SECRET_NAME_PATTERN})(?:\\}\\}|%7[Dd]%7[Dd])`,
88
+ "g"
89
+ );
81
90
  function checkAccess(caller, access) {
82
91
  if (caller.kind === "system") return null;
83
92
  if (access === "internal") return "FORBIDDEN";
@@ -126,6 +135,9 @@ export {
126
135
  DEPLOY_HEADERS,
127
136
  DEPLOY_PARTS,
128
137
  PAGES_APP_META,
138
+ SECRET_NAME,
139
+ secretPlaceholder,
140
+ SECRET_PLACEHOLDER,
129
141
  checkAccess,
130
142
  admit,
131
143
  isMember,
@@ -4,7 +4,7 @@ import {
4
4
  FILE_NAME_HEADER,
5
5
  SESSION_PATH,
6
6
  fileKeyPath
7
- } from "./WKI563UT.js";
7
+ } from "./RJHLCJUX.js";
8
8
 
9
9
  // src/client.ts
10
10
  var MethodError = class extends Error {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DEFAULT_CURRENCY,
3
3
  currencyDigits
4
- } from "./WKI563UT.js";
4
+ } from "./RJHLCJUX.js";
5
5
 
6
6
  // src/schema.ts
7
7
  import { getTableColumns, getTableName, is } from "drizzle-orm";
package/dist/client.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  MethodError,
3
3
  createClient
4
- } from "./chunks/A27ZPYPU.js";
5
- import "./chunks/WKI563UT.js";
4
+ } from "./chunks/TDLQQFGT.js";
5
+ import "./chunks/RJHLCJUX.js";
6
6
  export {
7
7
  MethodError,
8
8
  createClient
package/dist/dev/host.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  callableMethods,
11
11
  checkAccess,
12
12
  isMember
13
- } from "../chunks/WKI563UT.js";
13
+ } from "../chunks/RJHLCJUX.js";
14
14
 
15
15
  // src/dev/host.ts
16
16
  import { DurableObject, WorkerEntrypoint } from "cloudflare:workers";
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createApp,
3
3
  fail
4
- } from "./chunks/APGIRZ24.js";
5
- import "./chunks/NOOZYN7X.js";
6
- import "./chunks/WKI563UT.js";
4
+ } from "./chunks/O6KEZ2KL.js";
5
+ import "./chunks/TN5GZDH5.js";
6
+ import "./chunks/RJHLCJUX.js";
7
7
 
8
8
  // src/index.ts
9
9
  import { z } from "zod";
@@ -536,6 +536,57 @@ export interface AppFailure {
536
536
  attempt: number | null;
537
537
  dead: boolean | null;
538
538
  }
539
+ /**
540
+ * Whether an app is offline (ADR 0016), as `{APPS_PATH}/:appId/offline`
541
+ * says it to its creators: since when (epoch milliseconds) and who took it
542
+ * offline, or null while it is online. Offline, it answers only those who
543
+ * may publish it, until one of them brings it back.
544
+ */
545
+ export interface AppOffline {
546
+ offline: {
547
+ since: number;
548
+ by: string;
549
+ } | null;
550
+ }
551
+ /**
552
+ * A secret of an app (ADR 0015), as `GET {APPS_PATH}/:appId/secrets` lists
553
+ * them for its creators: by name, never by value. The app's code writes
554
+ * `{{secret:<name>}}` where the value goes in a request it sends out, and the
555
+ * runtime fills it in as the request leaves, for the hosts the secret may go
556
+ * to. Every secret the live version's code writes is listed, set or not.
557
+ */
558
+ export interface AppSecret {
559
+ name: string;
560
+ /** Whether it has a value. */
561
+ set: boolean;
562
+ /** Whether the live version's code writes it. */
563
+ used: boolean;
564
+ /** The only hosts it may be sent to (`*.example.com`: any below it); null: any host. */
565
+ hosts: string[] | null;
566
+ /** When it was last set (epoch milliseconds), and by whom; null while it has no value. */
567
+ updatedAt: number | null;
568
+ updatedBy: string | null;
569
+ }
570
+ /**
571
+ * What `PUT {APPS_PATH}/:appId/secrets/:name` takes: a new value, the hosts
572
+ * it may be sent to, or both; either left out stays as it was. A new secret
573
+ * needs a value, and an empty list of hosts is any host.
574
+ */
575
+ export interface SecretInput {
576
+ value?: string;
577
+ hosts?: string[] | null;
578
+ }
579
+ /** A secret's name: a capital letter, then capitals, digits and `_`, as `STRIPE_KEY`. */
580
+ export declare const SECRET_NAME: RegExp;
581
+ /** Where a secret's value goes in a request the app sends out, as its code writes it. */
582
+ export declare function secretPlaceholder(name: string): string;
583
+ /**
584
+ * A secret's placeholder as it reaches the runtime: as written, or
585
+ * percent-encoded where a URL's path or a form encoded it
586
+ * (`%7B%7Bsecret%3ANAME%7D%7D`). The name is its first group. Global, for
587
+ * `replace` and `matchAll`.
588
+ */
589
+ export declare const SECRET_PLACEHOLDER: RegExp;
539
590
  /**
540
591
  * The one access rule: may this caller invoke a method with this access level?
541
592
  * Returns the error code to report, or null when the call is allowed.
package/dist/protocol.js CHANGED
@@ -12,6 +12,8 @@ import {
12
12
  FILE_NAME_HEADER,
13
13
  PAGES_APP_META,
14
14
  PROTOCOL_VERSION,
15
+ SECRET_NAME,
16
+ SECRET_PLACEHOLDER,
15
17
  SESSION_PATH,
16
18
  SPACE_ROLES,
17
19
  admit,
@@ -21,8 +23,9 @@ import {
21
23
  fileKeyPath,
22
24
  isExposed,
23
25
  isMember,
24
- isPageAccess
25
- } from "./chunks/WKI563UT.js";
26
+ isPageAccess,
27
+ secretPlaceholder
28
+ } from "./chunks/RJHLCJUX.js";
26
29
  export {
27
30
  APPS_PATH,
28
31
  APP_COMPATIBILITY_DATE,
@@ -37,6 +40,8 @@ export {
37
40
  FILE_NAME_HEADER,
38
41
  PAGES_APP_META,
39
42
  PROTOCOL_VERSION,
43
+ SECRET_NAME,
44
+ SECRET_PLACEHOLDER,
40
45
  SESSION_PATH,
41
46
  SPACE_ROLES,
42
47
  admit,
@@ -46,5 +51,6 @@ export {
46
51
  fileKeyPath,
47
52
  isExposed,
48
53
  isMember,
49
- isPageAccess
54
+ isPageAccess,
55
+ secretPlaceholder
50
56
  };
package/dist/schema.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  col,
4
4
  describeTables,
5
5
  schemaOf
6
- } from "./chunks/NOOZYN7X.js";
7
- import "./chunks/WKI563UT.js";
6
+ } from "./chunks/TN5GZDH5.js";
7
+ import "./chunks/RJHLCJUX.js";
8
8
  export {
9
9
  attachment,
10
10
  col,
package/dist/testing.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  methodName
3
- } from "./chunks/APGIRZ24.js";
4
- import "./chunks/NOOZYN7X.js";
3
+ } from "./chunks/O6KEZ2KL.js";
4
+ import "./chunks/TN5GZDH5.js";
5
5
  import {
6
6
  MethodError
7
- } from "./chunks/A27ZPYPU.js";
7
+ } from "./chunks/TDLQQFGT.js";
8
8
  import {
9
9
  ERROR_STATUS
10
- } from "./chunks/WKI563UT.js";
10
+ } from "./chunks/RJHLCJUX.js";
11
11
 
12
12
  // src/testing.ts
13
13
  var OWNER = { kind: "user", userId: "test-owner", role: "owner", via: "api" };
package/dist/worker.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  MethodError
3
- } from "./chunks/A27ZPYPU.js";
3
+ } from "./chunks/TDLQQFGT.js";
4
4
  import {
5
5
  ERROR_STATUS
6
- } from "./chunks/WKI563UT.js";
6
+ } from "./chunks/RJHLCJUX.js";
7
7
 
8
8
  // src/worker.ts
9
9
  function thrower(caller) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teable/app",
3
- "version": "6.1.2",
3
+ "version": "6.1.4",
4
4
  "description": "Write a Teable app as a Drizzle schema plus methods",
5
5
  "license": "MIT",
6
6
  "repository": {