@veriforms/webapp-sdk 0.1.0 → 0.1.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/README.md CHANGED
@@ -129,10 +129,13 @@ save entries`). Real data and real writes are on the test version.
129
129
 
130
130
  ## Server functions — PILOT, PLATFORM ADMINISTRATORS ONLY
131
131
 
132
- > The gateway runs server functions only for a **platform administrator's own** web app, pushed and
133
- > released by a platform administrator, and only while the platform has them switched on (it is
134
- > **off in production**). For everyone else a build with `server/` is refused
135
- > (`bundle_server_code_not_enabled`). Not part of the public docs. Concept:
132
+ > Only a **platform administrator** may push and release server functions — for a web app in any
133
+ > account, customer accounts included (owner decision 2026-12-03: VeriForms builds customer solutions
134
+ > as a consulting offer). A version runs its functions only when an administrator released it, and
135
+ > only while the platform has them switched on (it is **off in production**). For everyone else — the
136
+ > app's owner included — a build with `server/` is refused (`bundle_server_code_not_enabled`), and so
137
+ > is publishing, restoring or promoting a version that carries one (`server_functions_not_enabled`):
138
+ > push a build without `server/`, or ask the VeriForms team to release it. Not part of the public docs. Concept:
136
139
  > `docs/webapp-builder/CWA-CODE-BACKEND-CONCEPT.md`; decisions: `CWA-DECISIONS.md`
137
140
  > ("Server functions, the developer side").
138
141
 
@@ -176,6 +179,8 @@ try {
176
179
  }
177
180
  ```
178
181
 
182
+ - **No input:** a function defined without `input` is called with no argument — `await server.listMyQuotes()`
183
+ (sent as `null`; since 0.1.1). A function with an `input` schema still needs its input.
179
184
  - **Routes:** the export name in camelCase is served in kebab-case — `placeOrder` → `/fn/place-order`
180
185
  (the build writes `export { placeOrder as "place-order" }`).
181
186
  - **The gateway reads the definition statically:** an object literal, `sources` as quoted names, `input`
@@ -323,7 +323,7 @@
323
323
  "callableFrom": {
324
324
  "type": "string",
325
325
  "enum": ["server"],
326
- "description": "\"server\": only the app's server functions may call this source, not the page directly (server functions are in a pilot for platform administrators). Absent = page and server functions."
326
+ "description": "\"server\": only the app's server functions may call this source, not the page directly (server functions are in a pilot: only platform administrators push and release them). Absent = page and server functions."
327
327
  },
328
328
  "anyoneMayRun": {
329
329
  "type": "string",
package/dist/index.d.ts CHANGED
@@ -15,7 +15,7 @@
15
15
  *
16
16
  * Concept: docs/webapp-builder/CWA-CODE-APPS-CONCEPT.md (§4.2).
17
17
  */
18
- export declare const SDK_VERSION = "0.1.0";
18
+ export declare const SDK_VERSION = "0.1.1";
19
19
  /**
20
20
  * Augmented by the `vf-app.d.ts` that `vf app types` generates:
21
21
  *
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@
15
15
  *
16
16
  * Concept: docs/webapp-builder/CWA-CODE-APPS-CONCEPT.md (§4.2).
17
17
  */
18
- export const SDK_VERSION = '0.1.0';
18
+ export const SDK_VERSION = '0.1.1';
19
19
  export function isVfRequestError(e) {
20
20
  return e instanceof Error;
21
21
  }
@@ -103,9 +103,15 @@ export interface CallOptions {
103
103
  * error body.
104
104
  */
105
105
  export declare function callServerFunction<N extends ServerFunctionName>(name: N, input?: InputOf<N>, opts?: CallOptions): Promise<OutputOf<N>>;
106
- /** The typed stub: `server.placeOrder(input)` is `callServerFunction('placeOrder', input)`. */
106
+ /**
107
+ * One function of the stub. A function WITHOUT an input schema takes no input (its input type is `unknown`),
108
+ * so the argument is optional: `server.listMyQuotes()` — sent as `null`, exactly like `callServerFunction(name)`.
109
+ * A function with a schema keeps its input required (unless the schema's type itself admits `undefined`).
110
+ */
111
+ export type ServerStubFunction<I, O> = unknown extends I ? (input?: I, opts?: CallOptions) => Promise<O> : undefined extends I ? (input?: I, opts?: CallOptions) => Promise<O> : (input: I, opts?: CallOptions) => Promise<O>;
112
+ /** The typed stub: `server.placeOrder(input)` is `callServerFunction('placeOrder', input)`; `server.ping()` needs no input. */
107
113
  export type ServerStub = {
108
- [N in keyof ServerFunctionRegistry & string]: (input: InputOf<N>, opts?: CallOptions) => Promise<OutputOf<N>>;
114
+ [N in keyof ServerFunctionRegistry & string]: ServerStubFunction<InputOf<N>, OutputOf<N>>;
109
115
  } & (Registered extends true ? unknown : Record<string, (input?: unknown, opts?: CallOptions) => Promise<unknown>>);
110
116
  export declare const server: ServerStub;
111
117
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veriforms/webapp-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Typed access to the VeriForms web app runtime (window.VF) for web apps built in code: data sources, tables, submissions, actions, payments, sign-in and pages.",
5
5
  "keywords": [
6
6
  "veriforms",