@feltdb/feltkit 0.0.0-stage → 0.2.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.
- package/LICENSE +21 -0
- package/README.md +22 -2
- package/bin/feltkit.js +3 -0
- package/dist/app.d.ts +247 -0
- package/dist/app.js +181 -0
- package/dist/app.js.map +1 -0
- package/dist/cli/deploy.d.ts +8 -0
- package/dist/cli/deploy.js +125 -0
- package/dist/cli/deploy.js.map +1 -0
- package/dist/cli/main.d.ts +9 -0
- package/dist/cli/main.js +581 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/output.d.ts +18 -0
- package/dist/cli/output.js +87 -0
- package/dist/cli/output.js.map +1 -0
- package/dist/cli/skills.d.ts +39 -0
- package/dist/cli/skills.js +125 -0
- package/dist/cli/skills.js.map +1 -0
- package/dist/client/index.d.ts +125 -0
- package/dist/client/index.js +306 -0
- package/dist/client/index.js.map +1 -0
- package/dist/dashboard/assets/index--1Tqbv_A.css +1 -0
- package/dist/dashboard/assets/index-Bm4qCYpv.js +15 -0
- package/dist/dashboard/index.html +16 -0
- package/dist/errors.d.ts +33 -0
- package/dist/errors.js +56 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/react/index.d.ts +40 -0
- package/dist/react/index.js +85 -0
- package/dist/react/index.js.map +1 -0
- package/dist/runtime/activity.d.ts +110 -0
- package/dist/runtime/activity.js +113 -0
- package/dist/runtime/activity.js.map +1 -0
- package/dist/runtime/agent.d.ts +353 -0
- package/dist/runtime/agent.js +1345 -0
- package/dist/runtime/agent.js.map +1 -0
- package/dist/runtime/authority.d.ts +98 -0
- package/dist/runtime/authority.js +240 -0
- package/dist/runtime/authority.js.map +1 -0
- package/dist/runtime/changes.d.ts +42 -0
- package/dist/runtime/changes.js +85 -0
- package/dist/runtime/changes.js.map +1 -0
- package/dist/runtime/content.d.ts +33 -0
- package/dist/runtime/content.js +46 -0
- package/dist/runtime/content.js.map +1 -0
- package/dist/runtime/context.d.ts +76 -0
- package/dist/runtime/context.js +2 -0
- package/dist/runtime/context.js.map +1 -0
- package/dist/runtime/credentials.d.ts +42 -0
- package/dist/runtime/credentials.js +32 -0
- package/dist/runtime/credentials.js.map +1 -0
- package/dist/runtime/data.d.ts +145 -0
- package/dist/runtime/data.js +439 -0
- package/dist/runtime/data.js.map +1 -0
- package/dist/runtime/decisions.d.ts +131 -0
- package/dist/runtime/decisions.js +301 -0
- package/dist/runtime/decisions.js.map +1 -0
- package/dist/runtime/environment.d.ts +36 -0
- package/dist/runtime/environment.js +73 -0
- package/dist/runtime/environment.js.map +1 -0
- package/dist/runtime/idempotency.d.ts +37 -0
- package/dist/runtime/idempotency.js +88 -0
- package/dist/runtime/idempotency.js.map +1 -0
- package/dist/runtime/instance.d.ts +82 -0
- package/dist/runtime/instance.js +253 -0
- package/dist/runtime/instance.js.map +1 -0
- package/dist/runtime/integrations.d.ts +120 -0
- package/dist/runtime/integrations.js +412 -0
- package/dist/runtime/integrations.js.map +1 -0
- package/dist/runtime/loader.d.ts +15 -0
- package/dist/runtime/loader.js +121 -0
- package/dist/runtime/loader.js.map +1 -0
- package/dist/runtime/projects.d.ts +52 -0
- package/dist/runtime/projects.js +141 -0
- package/dist/runtime/projects.js.map +1 -0
- package/dist/runtime/readiness.d.ts +29 -0
- package/dist/runtime/readiness.js +154 -0
- package/dist/runtime/readiness.js.map +1 -0
- package/dist/runtime/runtime.d.ts +227 -0
- package/dist/runtime/runtime.js +664 -0
- package/dist/runtime/runtime.js.map +1 -0
- package/dist/runtime/services.d.ts +327 -0
- package/dist/runtime/services.js +686 -0
- package/dist/runtime/services.js.map +1 -0
- package/dist/runtime/sessions.d.ts +44 -0
- package/dist/runtime/sessions.js +109 -0
- package/dist/runtime/sessions.js.map +1 -0
- package/dist/schema.d.ts +56 -0
- package/dist/schema.js +44 -0
- package/dist/schema.js.map +1 -0
- package/dist/server/admin.d.ts +141 -0
- package/dist/server/admin.js +828 -0
- package/dist/server/admin.js.map +1 -0
- package/dist/server/http.d.ts +19 -0
- package/dist/server/http.js +99 -0
- package/dist/server/http.js.map +1 -0
- package/dist/server/index.d.ts +54 -0
- package/dist/server/index.js +305 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/management.d.ts +12 -0
- package/dist/server/management.js +177 -0
- package/dist/server/management.js.map +1 -0
- package/dist/server/mcp.d.ts +214 -0
- package/dist/server/mcp.js +135 -0
- package/dist/server/mcp.js.map +1 -0
- package/dist/server/operators.d.ts +77 -0
- package/dist/server/operators.js +162 -0
- package/dist/server/operators.js.map +1 -0
- package/dist/server/project.d.ts +60 -0
- package/dist/server/project.js +344 -0
- package/dist/server/project.js.map +1 -0
- package/dist/server/public.d.ts +14 -0
- package/dist/server/public.js +15 -0
- package/dist/server/public.js.map +1 -0
- package/dist/testing/index.d.ts +20 -0
- package/dist/testing/index.js +65 -0
- package/dist/testing/index.js.map +1 -0
- package/package.json +91 -4
- package/skills/.claude-plugin/marketplace.json +16 -0
- package/skills/.claude-plugin/plugin.json +24 -0
- package/skills/README.md +44 -0
- package/skills/feltkit-agent/SKILL.md +84 -0
- package/skills/feltkit-build/SKILL.md +143 -0
- package/skills/feltkit-data/SKILL.md +79 -0
- package/skills/feltkit-operations/SKILL.md +72 -0
- package/skills/feltkit-services/SKILL.md +102 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Randy Kendel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @feltdb/feltkit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The FeltKit SDK, runtime, server, CLI, React bindings, and dashboard.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm create feltkit@latest my-app && cd my-app && npm install && npm run dev
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
| Import | Use |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `@feltdb/feltkit` | `feltkit()`, `s`, collections, `app.query`, `app.mutation`, `fail`, types |
|
|
12
|
+
| `@feltdb/feltkit/client` | `createClient`, `createApi`, `ref` — call functions from a browser or Node |
|
|
13
|
+
| `@feltdb/feltkit/react` | `FeltKitProvider`, `useQuery`, `useQueryState`, `useMutation`, `useSession`, `useConnectionState` |
|
|
14
|
+
| `@feltdb/feltkit/testing` | `createTestApp()` — run the app in-process against an isolated FeltDB instance |
|
|
15
|
+
| `@feltdb/feltkit/server` | `startServer` and friends, for embedding |
|
|
16
|
+
| bin `feltkit` | `create`, `dev`, `build`, `start`, `test`, `inspect`, `deploy`, `session`, `doctor`, `codegen` |
|
|
17
|
+
|
|
18
|
+
Built on [`@feltdb/core`](https://www.npmjs.com/package/@feltdb/core),
|
|
19
|
+
[`@appport/sdk`](https://www.npmjs.com/package/@appport/sdk), and
|
|
20
|
+
[`@appport/services`](https://www.npmjs.com/package/@appport/services). Every component
|
|
21
|
+
of a FeltKit application shares one FeltDB instance per environment.
|
|
22
|
+
|
|
23
|
+
Documentation: https://github.com/rkendel1/concave#readme
|
package/bin/feltkit.js
ADDED
package/dist/app.d.ts
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import type { ServicesConfig } from "./runtime/services.js";
|
|
2
|
+
import type { DecisionRuntimeOption } from "./runtime/decisions.js";
|
|
3
|
+
/**
|
|
4
|
+
* The application definition: what a developer writes.
|
|
5
|
+
*
|
|
6
|
+
* Definitions are plain data. Nothing here opens a database, starts a server, or
|
|
7
|
+
* registers anything globally; the runtime (`FeltKitRuntime`) reads these
|
|
8
|
+
* definitions and wires them to the environment's single FeltDB instance.
|
|
9
|
+
*/
|
|
10
|
+
import type { Schema } from "@appport/sdk";
|
|
11
|
+
import { type Doc, type InferShape, type ShapeInput, type Simplify } from "./schema.js";
|
|
12
|
+
import type { MutationCtx, QueryCtx } from "./runtime/context.js";
|
|
13
|
+
declare const APP: unique symbol;
|
|
14
|
+
declare const COLLECTION: unique symbol;
|
|
15
|
+
declare const FUNCTION: unique symbol;
|
|
16
|
+
/** Collection names owned by the layers underneath. Application collections may not use them. */
|
|
17
|
+
export declare const RESERVED_COLLECTIONS: Set<string>;
|
|
18
|
+
export interface DevUser {
|
|
19
|
+
/** Stable principal id. */
|
|
20
|
+
id: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
/** Role names from `roles`. */
|
|
23
|
+
roles: string[];
|
|
24
|
+
type?: "user" | "agent" | "service";
|
|
25
|
+
}
|
|
26
|
+
export interface PrincipalInput {
|
|
27
|
+
id: string;
|
|
28
|
+
type?: "user" | "agent" | "service";
|
|
29
|
+
displayName?: string;
|
|
30
|
+
roles: string[];
|
|
31
|
+
}
|
|
32
|
+
export interface AuthenticateRequest {
|
|
33
|
+
method: string;
|
|
34
|
+
path: string;
|
|
35
|
+
headers: Readonly<Record<string, string | undefined>>;
|
|
36
|
+
}
|
|
37
|
+
export interface FeltKitOptions {
|
|
38
|
+
/** Application name. Used as the AppPort application id and the FeltDB namespace. */
|
|
39
|
+
name: string;
|
|
40
|
+
version?: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Role → permissions. Permissions are AppPort permission strings; `tasks.*` grants
|
|
44
|
+
* every `tasks.` permission and `*` grants everything.
|
|
45
|
+
*/
|
|
46
|
+
roles?: Record<string, string[]>;
|
|
47
|
+
auth?: {
|
|
48
|
+
/**
|
|
49
|
+
* Production identity hook: verify the request with your identity provider and
|
|
50
|
+
* return the principal, or null. Called only when no FeltKit session token is present.
|
|
51
|
+
* FeltKit never trusts identity claims sent by a client without this hook.
|
|
52
|
+
*/
|
|
53
|
+
authenticate?: (request: AuthenticateRequest) => PrincipalInput | null | Promise<PrincipalInput | null>;
|
|
54
|
+
/** Session lifetime. Default 7 days. */
|
|
55
|
+
sessionTtlMs?: number;
|
|
56
|
+
};
|
|
57
|
+
/** Development-only identities you can sign in as. Ignored outside development and test. */
|
|
58
|
+
dev?: {
|
|
59
|
+
users?: DevUser[];
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* AppPort Services, run on the application's FeltDB instance. Each enabled service
|
|
63
|
+
* gets its packaged management page in Studio (Services → Manage).
|
|
64
|
+
*
|
|
65
|
+
* files, notifications, configuration see the guarantees
|
|
66
|
+
* apiKeys: { roles } keys authenticate as an identity holding these roles
|
|
67
|
+
* webhooks signing secrets come from FELTKIT_CREDENTIAL_<ID>
|
|
68
|
+
* jobs: { handlers } job type → "<module>:<function>", run as the enqueuer
|
|
69
|
+
* schedules recurring jobs (needs jobs)
|
|
70
|
+
* intelligence provider/model configuration only
|
|
71
|
+
*/
|
|
72
|
+
services?: ServicesConfig;
|
|
73
|
+
/** The FeltKit agent. */
|
|
74
|
+
agent?: {
|
|
75
|
+
/**
|
|
76
|
+
* The model that makes decisions (`playbook: "decide"`, `ctx.agent.start`): any FeltDB
|
|
77
|
+
* `DecisionRuntime`, or a function of the environment returning one. When omitted, the
|
|
78
|
+
* environment's AppPort Services Intelligence selection is used.
|
|
79
|
+
*/
|
|
80
|
+
decisions?: DecisionRuntimeOption;
|
|
81
|
+
/** Per decision. Default 20 s. */
|
|
82
|
+
decisionTimeoutMs?: number;
|
|
83
|
+
};
|
|
84
|
+
activity?: {
|
|
85
|
+
/** What to record. Default: "all" in development/test, "writes" in production. */
|
|
86
|
+
record?: "all" | "writes" | "errors";
|
|
87
|
+
/** Entries kept. Default 2000. */
|
|
88
|
+
retain?: number;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
export interface CollectionDefinition<S extends ShapeInput = ShapeInput> {
|
|
92
|
+
readonly [COLLECTION]: true;
|
|
93
|
+
readonly name: string;
|
|
94
|
+
readonly shape: S;
|
|
95
|
+
readonly schema: Schema;
|
|
96
|
+
readonly description?: string;
|
|
97
|
+
/** Type-only marker. */
|
|
98
|
+
readonly $doc?: Doc<S>;
|
|
99
|
+
}
|
|
100
|
+
export type Access = "public" | "authenticated" | (string & {});
|
|
101
|
+
export interface CapabilityExposure {
|
|
102
|
+
/** AppPort capability name, e.g. "tasks.complete". */
|
|
103
|
+
name: string;
|
|
104
|
+
description?: string;
|
|
105
|
+
version?: number;
|
|
106
|
+
}
|
|
107
|
+
export type FunctionKind = "query" | "mutation";
|
|
108
|
+
/** One operation of an HTTP integration. */
|
|
109
|
+
export interface IntegrationOperation {
|
|
110
|
+
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
111
|
+
/** Path below baseUrl. `{field}` is filled from the input (and removed from the body). */
|
|
112
|
+
path: string;
|
|
113
|
+
description?: string;
|
|
114
|
+
input?: ShapeInput;
|
|
115
|
+
output: Schema;
|
|
116
|
+
/** "observation" reads (GET); "consequential" may change the external system. */
|
|
117
|
+
effect: "observation" | "consequential";
|
|
118
|
+
/** The permission that may invoke it. Discovery grants nothing. */
|
|
119
|
+
access: string;
|
|
120
|
+
/**
|
|
121
|
+
* The API deduplicates requests by this header (e.g. "Idempotency-Key"). FeltKit sends a
|
|
122
|
+
* stable key per request, so repeating *the same* request is safe.
|
|
123
|
+
*/
|
|
124
|
+
idempotencyHeader?: string;
|
|
125
|
+
/**
|
|
126
|
+
* How to confirm whether a consequential call took effect without repeating it: an
|
|
127
|
+
* observation of this integration, its input (values or { $input } / { $output } refs),
|
|
128
|
+
* and what its output must show (AppPort `StateVerification`). `$input` refers to this
|
|
129
|
+
* operation's declared input (AppPort checks it), so verify by a business key the API
|
|
130
|
+
* indexes. A NOT_FOUND answer means the effect did not happen.
|
|
131
|
+
*/
|
|
132
|
+
verify?: {
|
|
133
|
+
operation: string;
|
|
134
|
+
input: Record<string, unknown>;
|
|
135
|
+
expect: Array<{
|
|
136
|
+
at: string;
|
|
137
|
+
equals?: unknown;
|
|
138
|
+
exists?: true;
|
|
139
|
+
}>;
|
|
140
|
+
};
|
|
141
|
+
/** What the effect is, for the published contract (e.g. ["payment.created"]). */
|
|
142
|
+
effects?: string[];
|
|
143
|
+
/**
|
|
144
|
+
* A mutation ("<module>:<function>") run as the caller with the call's record
|
|
145
|
+
* ({ call: { id, state, determinedBy, input, output, error, … } }) when a call finishes —
|
|
146
|
+
* including `unknown` — and again when verification settles it. It may run more than
|
|
147
|
+
* once for one call; make it idempotent (key it by call.id).
|
|
148
|
+
*/
|
|
149
|
+
onOutcome?: string;
|
|
150
|
+
}
|
|
151
|
+
export interface IntegrationConfig<Ops extends Record<string, IntegrationOperation> = Record<string, IntegrationOperation>> {
|
|
152
|
+
description?: string;
|
|
153
|
+
/** A URL, or an environment variable (with a value used only in development and test). */
|
|
154
|
+
baseUrl: string | {
|
|
155
|
+
env: string;
|
|
156
|
+
development?: string;
|
|
157
|
+
};
|
|
158
|
+
/** A credential reference sent as `Authorization: Bearer <value>` (or `header`). Resolved server-side. */
|
|
159
|
+
credential?: string | {
|
|
160
|
+
ref: string;
|
|
161
|
+
header?: string;
|
|
162
|
+
scheme?: string;
|
|
163
|
+
};
|
|
164
|
+
/** Per call. Default 10 s. */
|
|
165
|
+
timeoutMs?: number;
|
|
166
|
+
/** A read-only path used to check the API is reachable (Studio, readiness). */
|
|
167
|
+
health?: {
|
|
168
|
+
path: string;
|
|
169
|
+
};
|
|
170
|
+
operations: Ops;
|
|
171
|
+
}
|
|
172
|
+
export type IntegrationDefinition<Ops extends Record<string, IntegrationOperation> = Record<string, IntegrationOperation>> = Readonly<IntegrationConfig<Ops>> & {
|
|
173
|
+
readonly name: string;
|
|
174
|
+
readonly operations: {
|
|
175
|
+
readonly [K in keyof Ops]: Readonly<Ops[K]> & {
|
|
176
|
+
readonly inputSchema: Schema;
|
|
177
|
+
readonly capability: string;
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
export interface FunctionConfig<Kind extends FunctionKind, A extends ShapeInput, R> {
|
|
182
|
+
args?: A;
|
|
183
|
+
/** Output contract. Required when the function is exposed as a capability. */
|
|
184
|
+
returns?: Schema<R>;
|
|
185
|
+
/**
|
|
186
|
+
* Who may call it: "public", "authenticated" (default), or a permission string such
|
|
187
|
+
* as "tasks.write". Checked before the handler runs, on every interface.
|
|
188
|
+
*/
|
|
189
|
+
access?: Access;
|
|
190
|
+
description?: string;
|
|
191
|
+
/** Publish this function as an AppPort capability (discoverable by agents and other apps). */
|
|
192
|
+
capability?: CapabilityExposure | string;
|
|
193
|
+
handler: (ctx: Kind extends "query" ? QueryCtx : MutationCtx, args: Simplify<InferShape<A>>) => R | Promise<R>;
|
|
194
|
+
}
|
|
195
|
+
export interface FunctionDefinition<Kind extends FunctionKind = FunctionKind, Args = any, Result = any> {
|
|
196
|
+
readonly [FUNCTION]: true;
|
|
197
|
+
readonly kind: Kind;
|
|
198
|
+
readonly args: ShapeInput;
|
|
199
|
+
readonly argsSchema: Schema;
|
|
200
|
+
readonly returns?: Schema;
|
|
201
|
+
readonly access: Access;
|
|
202
|
+
readonly description?: string;
|
|
203
|
+
readonly capability?: Required<Pick<CapabilityExposure, "name" | "version">> & {
|
|
204
|
+
description?: string;
|
|
205
|
+
};
|
|
206
|
+
readonly handler: (ctx: any, args: any) => unknown;
|
|
207
|
+
readonly app: FeltKitApp;
|
|
208
|
+
/** Type-only markers. */
|
|
209
|
+
readonly $args?: Args;
|
|
210
|
+
readonly $result?: Result;
|
|
211
|
+
}
|
|
212
|
+
export type QueryDefinition<Args = any, Result = any> = FunctionDefinition<"query", Args, Result>;
|
|
213
|
+
export type MutationDefinition<Args = any, Result = any> = FunctionDefinition<"mutation", Args, Result>;
|
|
214
|
+
type Handler<Kind extends FunctionKind, R> = (ctx: Kind extends "query" ? QueryCtx : MutationCtx) => R | Promise<R>;
|
|
215
|
+
export declare class FeltKitApp {
|
|
216
|
+
readonly [APP] = true;
|
|
217
|
+
readonly options: Readonly<FeltKitOptions>;
|
|
218
|
+
readonly collections: Map<string, CollectionDefinition<ShapeInput>>;
|
|
219
|
+
readonly integrations: Map<string, IntegrationDefinition<Record<string, IntegrationOperation>>>;
|
|
220
|
+
constructor(options: FeltKitOptions);
|
|
221
|
+
get name(): string;
|
|
222
|
+
/** Declare a collection of records stored in the application's FeltDB instance. */
|
|
223
|
+
collection<S extends ShapeInput>(name: string, shape: S, options?: {
|
|
224
|
+
description?: string;
|
|
225
|
+
}): CollectionDefinition<S>;
|
|
226
|
+
/**
|
|
227
|
+
* Connect an existing HTTP API. Each operation becomes an AppPort capability named
|
|
228
|
+
* `<integration>.<operation>`, with its effect, the permission that may invoke it,
|
|
229
|
+
* whether the API deduplicates retries, and how to verify an outcome. Discovering it
|
|
230
|
+
* grants nothing. Calls are recorded as evidence before and after they are sent; an
|
|
231
|
+
* outcome that cannot be known is reported as such and verified, never re-sent.
|
|
232
|
+
*/
|
|
233
|
+
integration<Ops extends Record<string, IntegrationOperation>>(name: string, config: IntegrationConfig<Ops>): IntegrationDefinition<Ops>;
|
|
234
|
+
/** A read-only function. Its database handle cannot write. */
|
|
235
|
+
query<R>(handler: Handler<"query", R>): QueryDefinition<{}, Awaited<R>>;
|
|
236
|
+
query<A extends ShapeInput = {}, R = unknown>(config: FunctionConfig<"query", A, R>): QueryDefinition<Simplify<InferShape<A>>, Awaited<R>>;
|
|
237
|
+
/** A function that changes state. All of its writes commit atomically, or none do. */
|
|
238
|
+
mutation<R>(handler: Handler<"mutation", R>): MutationDefinition<{}, Awaited<R>>;
|
|
239
|
+
mutation<A extends ShapeInput = {}, R = unknown>(config: FunctionConfig<"mutation", A, R>): MutationDefinition<Simplify<InferShape<A>>, Awaited<R>>;
|
|
240
|
+
private define;
|
|
241
|
+
}
|
|
242
|
+
/** Define a FeltKit application. */
|
|
243
|
+
export declare function feltkit(options: FeltKitOptions): FeltKitApp;
|
|
244
|
+
export declare function isFeltKitApp(value: unknown): value is FeltKitApp;
|
|
245
|
+
export declare function isFunctionDefinition(value: unknown): value is FunctionDefinition;
|
|
246
|
+
export declare function isCollectionDefinition(value: unknown): value is CollectionDefinition;
|
|
247
|
+
export {};
|
package/dist/app.js
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { validateName } from "@appport/protocol";
|
|
2
|
+
import { RESERVED_FIELDS, shapeToObjectSchema } from "./schema.js";
|
|
3
|
+
const APP = Symbol.for("feltkit.app");
|
|
4
|
+
const COLLECTION = Symbol.for("feltkit.collection");
|
|
5
|
+
const FUNCTION = Symbol.for("feltkit.function");
|
|
6
|
+
/** Collection names owned by the layers underneath. Application collections may not use them. */
|
|
7
|
+
export const RESERVED_COLLECTIONS = new Set([
|
|
8
|
+
// AppPort Services (every service it can construct on the shared instance)
|
|
9
|
+
"files",
|
|
10
|
+
"file_audit_events",
|
|
11
|
+
"service_effect_evidence",
|
|
12
|
+
"notifications",
|
|
13
|
+
"notification_deliveries",
|
|
14
|
+
"notification_audit_events",
|
|
15
|
+
"api_keys",
|
|
16
|
+
"api_key_prefixes",
|
|
17
|
+
"api_key_audit_events",
|
|
18
|
+
"webhook_endpoints",
|
|
19
|
+
"webhook_deliveries",
|
|
20
|
+
"webhook_audit_events",
|
|
21
|
+
"webhook_integrations",
|
|
22
|
+
"inbound_webhook_events",
|
|
23
|
+
"jobs",
|
|
24
|
+
"job_schedules",
|
|
25
|
+
"job_audit_events",
|
|
26
|
+
"ConfigurationVariables",
|
|
27
|
+
"ConfigurationSecrets",
|
|
28
|
+
"ConfigurationAuditEvents",
|
|
29
|
+
]);
|
|
30
|
+
const RESERVED_PREFIXES = ["_feltkit", "_flow", "_feltdb", "_appport"];
|
|
31
|
+
export class FeltKitApp {
|
|
32
|
+
[APP] = true;
|
|
33
|
+
options;
|
|
34
|
+
collections = new Map();
|
|
35
|
+
integrations = new Map();
|
|
36
|
+
constructor(options) {
|
|
37
|
+
if (!options || typeof options.name !== "string" || !/^[a-z][a-z0-9-]{0,62}$/.test(options.name)) {
|
|
38
|
+
throw new TypeError(`feltkit({ name }) needs a lowercase name of letters, digits, and dashes (got ${JSON.stringify(options?.name)}).`);
|
|
39
|
+
}
|
|
40
|
+
for (const [role, permissions] of Object.entries(options.roles ?? {})) {
|
|
41
|
+
if (!Array.isArray(permissions) || permissions.some((p) => typeof p !== "string" || !p)) {
|
|
42
|
+
throw new TypeError(`Role "${role}" must map to an array of permission strings.`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
for (const user of options.dev?.users ?? []) {
|
|
46
|
+
for (const role of user.roles) {
|
|
47
|
+
if (!options.roles?.[role])
|
|
48
|
+
throw new TypeError(`Dev user "${user.id}" has role "${role}", which is not declared in roles.`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
this.options = Object.freeze({ ...options });
|
|
52
|
+
}
|
|
53
|
+
get name() {
|
|
54
|
+
return this.options.name;
|
|
55
|
+
}
|
|
56
|
+
/** Declare a collection of records stored in the application's FeltDB instance. */
|
|
57
|
+
collection(name, shape, options = {}) {
|
|
58
|
+
if (!/^[a-z][a-zA-Z0-9_]{0,62}$/.test(name)) {
|
|
59
|
+
throw new TypeError(`Collection name "${name}" must start with a lowercase letter and contain only letters, digits, and "_".`);
|
|
60
|
+
}
|
|
61
|
+
if (RESERVED_COLLECTIONS.has(name) || RESERVED_PREFIXES.some((prefix) => name.startsWith(prefix))) {
|
|
62
|
+
throw new TypeError(`Collection name "${name}" is reserved by the platform. Choose another name.`);
|
|
63
|
+
}
|
|
64
|
+
if (this.collections.has(name))
|
|
65
|
+
throw new TypeError(`Collection "${name}" is declared twice.`);
|
|
66
|
+
for (const field of RESERVED_FIELDS) {
|
|
67
|
+
if (field in shape)
|
|
68
|
+
throw new TypeError(`Collection "${name}" may not declare "${field}"; FeltDB manages it.`);
|
|
69
|
+
}
|
|
70
|
+
const definition = {
|
|
71
|
+
[COLLECTION]: true,
|
|
72
|
+
name,
|
|
73
|
+
shape,
|
|
74
|
+
schema: shapeToObjectSchema(shape),
|
|
75
|
+
...(options.description ? { description: options.description } : {}),
|
|
76
|
+
};
|
|
77
|
+
this.collections.set(name, definition);
|
|
78
|
+
return definition;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Connect an existing HTTP API. Each operation becomes an AppPort capability named
|
|
82
|
+
* `<integration>.<operation>`, with its effect, the permission that may invoke it,
|
|
83
|
+
* whether the API deduplicates retries, and how to verify an outcome. Discovering it
|
|
84
|
+
* grants nothing. Calls are recorded as evidence before and after they are sent; an
|
|
85
|
+
* outcome that cannot be known is reported as such and verified, never re-sent.
|
|
86
|
+
*/
|
|
87
|
+
integration(name, config) {
|
|
88
|
+
if (!/^[a-z][a-z0-9]{0,30}$/.test(name))
|
|
89
|
+
throw new TypeError(`Integration name "${name}" must be lowercase letters and digits (e.g. "payments").`);
|
|
90
|
+
if (this.integrations.has(name))
|
|
91
|
+
throw new TypeError(`Integration "${name}" is declared twice.`);
|
|
92
|
+
if (!config || typeof config.baseUrl === "undefined")
|
|
93
|
+
throw new TypeError(`Integration "${name}" needs a baseUrl (a URL, or { env: "NAME" }).`);
|
|
94
|
+
if (!config.operations || !Object.keys(config.operations).length)
|
|
95
|
+
throw new TypeError(`Integration "${name}" declares no operations.`);
|
|
96
|
+
const operations = {};
|
|
97
|
+
for (const [op, def] of Object.entries(config.operations)) {
|
|
98
|
+
const capability = `${name}.${op}`;
|
|
99
|
+
const check = validateName(capability);
|
|
100
|
+
if (!check.valid)
|
|
101
|
+
throw new TypeError(`Integration operation "${capability}" is not a valid AppPort name: ${check.reason}.`);
|
|
102
|
+
if (!["GET", "POST", "PUT", "PATCH", "DELETE"].includes(def.method))
|
|
103
|
+
throw new TypeError(`${capability}: method must be GET, POST, PUT, PATCH, or DELETE.`);
|
|
104
|
+
if (typeof def.path !== "string" || !def.path.startsWith("/"))
|
|
105
|
+
throw new TypeError(`${capability}: path must start with "/".`);
|
|
106
|
+
if (def.effect !== "observation" && def.effect !== "consequential")
|
|
107
|
+
throw new TypeError(`${capability}: effect must be "observation" or "consequential".`);
|
|
108
|
+
if (def.effect === "observation" && def.method !== "GET")
|
|
109
|
+
throw new TypeError(`${capability}: an observation must be a GET.`);
|
|
110
|
+
if (typeof def.access !== "string" || !def.access || def.access === "public")
|
|
111
|
+
throw new TypeError(`${capability}: access must name the permission that may invoke it (e.g. "${name}.write").`);
|
|
112
|
+
if (!def.output)
|
|
113
|
+
throw new TypeError(`${capability}: output schema is required (AppPort publishes and enforces it).`);
|
|
114
|
+
if (def.verify) {
|
|
115
|
+
const probe = config.operations[def.verify.operation];
|
|
116
|
+
if (!probe || probe.effect !== "observation")
|
|
117
|
+
throw new TypeError(`${capability}: verify.operation must name an observation of "${name}".`);
|
|
118
|
+
}
|
|
119
|
+
if (def.onOutcome !== undefined && !/^[\w/-]+:[\w]+$/.test(def.onOutcome))
|
|
120
|
+
throw new TypeError(`${capability}: onOutcome names a mutation as "<module>:<function>".`);
|
|
121
|
+
operations[op] = Object.freeze({ ...def, inputSchema: shapeToObjectSchema(def.input ?? {}), capability });
|
|
122
|
+
}
|
|
123
|
+
const definition = Object.freeze({ name, ...config, operations });
|
|
124
|
+
this.integrations.set(name, definition);
|
|
125
|
+
return definition;
|
|
126
|
+
}
|
|
127
|
+
query(input) {
|
|
128
|
+
return this.define("query", input);
|
|
129
|
+
}
|
|
130
|
+
mutation(input) {
|
|
131
|
+
return this.define("mutation", input);
|
|
132
|
+
}
|
|
133
|
+
define(kind, input) {
|
|
134
|
+
const config = (typeof input === "function" ? { handler: input } : input);
|
|
135
|
+
if (!config || typeof config.handler !== "function")
|
|
136
|
+
throw new TypeError(`app.${kind}() needs a handler function.`);
|
|
137
|
+
const args = config.args ?? {};
|
|
138
|
+
let capability;
|
|
139
|
+
if (config.capability) {
|
|
140
|
+
const exposure = typeof config.capability === "string" ? { name: config.capability } : config.capability;
|
|
141
|
+
const check = validateName(exposure.name);
|
|
142
|
+
if (!check.valid) {
|
|
143
|
+
throw new TypeError(`Capability name "${exposure.name}" is not a valid AppPort name: ${check.reason} (e.g. "tasks.complete").`);
|
|
144
|
+
}
|
|
145
|
+
if (!config.returns) {
|
|
146
|
+
throw new TypeError(`Capability "${exposure.name}" needs a \`returns\` schema: AppPort publishes and enforces its output contract.`);
|
|
147
|
+
}
|
|
148
|
+
capability = {
|
|
149
|
+
name: exposure.name,
|
|
150
|
+
version: exposure.version ?? 1,
|
|
151
|
+
...((exposure.description ?? config.description) ? { description: exposure.description ?? config.description } : {}),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
return Object.freeze({
|
|
155
|
+
[FUNCTION]: true,
|
|
156
|
+
kind,
|
|
157
|
+
args,
|
|
158
|
+
argsSchema: shapeToObjectSchema(args),
|
|
159
|
+
...(config.returns ? { returns: config.returns } : {}),
|
|
160
|
+
access: config.access ?? "authenticated",
|
|
161
|
+
...(config.description ? { description: config.description } : {}),
|
|
162
|
+
...(capability ? { capability } : {}),
|
|
163
|
+
handler: config.handler,
|
|
164
|
+
app: this,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/** Define a FeltKit application. */
|
|
169
|
+
export function feltkit(options) {
|
|
170
|
+
return new FeltKitApp(options);
|
|
171
|
+
}
|
|
172
|
+
export function isFeltKitApp(value) {
|
|
173
|
+
return typeof value === "object" && value !== null && value[APP] === true;
|
|
174
|
+
}
|
|
175
|
+
export function isFunctionDefinition(value) {
|
|
176
|
+
return typeof value === "object" && value !== null && value[FUNCTION] === true;
|
|
177
|
+
}
|
|
178
|
+
export function isCollectionDefinition(value) {
|
|
179
|
+
return typeof value === "object" && value !== null && value[COLLECTION] === true;
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=app.js.map
|
package/dist/app.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAA6D,MAAM,aAAa,CAAC;AAG9H,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AACtC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;AACpD,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;AAEhD,iGAAiG;AACjG,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC;IAC1C,2EAA2E;IAC3E,OAAO;IACP,mBAAmB;IACnB,yBAAyB;IACzB,eAAe;IACf,yBAAyB;IACzB,2BAA2B;IAC3B,UAAU;IACV,kBAAkB;IAClB,sBAAsB;IACtB,mBAAmB;IACnB,oBAAoB;IACpB,sBAAsB;IACtB,sBAAsB;IACtB,wBAAwB;IACxB,MAAM;IACN,eAAe;IACf,kBAAkB;IAClB,wBAAwB;IACxB,sBAAsB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EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACrC,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,GAAG,EAAE,IAAI;SACV,CAAC,CAAC;IACL,CAAC;CACF;AAED,oCAAoC;AACpC,MAAM,UAAU,OAAO,CAAC,OAAuB;IAC7C,OAAO,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAK,KAAiC,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;AACzG,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAc;IACjD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAK,KAAiC,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;AAC9G,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,KAAc;IACnD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAK,KAAiC,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;AAChH,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `feltkit deploy`: a verified, self-contained deployment artifact.
|
|
3
|
+
*
|
|
4
|
+
* FeltKit does not operate a hosting service. Deploy builds the application, proves
|
|
5
|
+
* the production build boots and answers (against a throwaway state directory, so
|
|
6
|
+
* no real state is touched), and writes a directory any Node 20+ host or container
|
|
7
|
+
* can run.
|
|
8
|
+
*/
|
|
9
|
+
import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
10
|
+
import { tmpdir } from "node:os";
|
|
11
|
+
import { join, resolve } from "node:path";
|
|
12
|
+
import { FeltKitError } from "../errors.js";
|
|
13
|
+
import { silentLogger } from "../runtime/runtime.js";
|
|
14
|
+
import { BUILD_DIR, SDK_VERSION, build, readPackageJson, startProduction } from "../server/project.js";
|
|
15
|
+
export async function deploy(options) {
|
|
16
|
+
const projectDir = resolve(options.projectDir);
|
|
17
|
+
const pkg = readPackageJson(projectDir);
|
|
18
|
+
const result = await build(projectDir);
|
|
19
|
+
// Verify the production build boots. Isolated state, random port, then stop.
|
|
20
|
+
const scratch = mkdtempSync(join(tmpdir(), "feltkit-deploy-check-"));
|
|
21
|
+
const previous = { state: process.env.FELTKIT_STATE_DIR, url: process.env.FELTDB_URL };
|
|
22
|
+
process.env.FELTKIT_STATE_DIR = join(scratch, "state");
|
|
23
|
+
delete process.env.FELTDB_URL;
|
|
24
|
+
try {
|
|
25
|
+
const server = await startProduction({ projectDir, port: 0, host: "127.0.0.1", environment: "production", logger: silentLogger });
|
|
26
|
+
try {
|
|
27
|
+
const health = await fetch(`${server.server.url}/_feltkit/health`);
|
|
28
|
+
if (!health.ok)
|
|
29
|
+
throw new FeltKitError("UNAVAILABLE", `The production build started but /_feltkit/health answered ${health.status}.`);
|
|
30
|
+
const manifest = await fetch(`${server.server.url}/appport/manifest`);
|
|
31
|
+
if (!manifest.ok && manifest.status !== 404)
|
|
32
|
+
throw new FeltKitError("UNAVAILABLE", `The AppPort endpoint answered ${manifest.status}.`);
|
|
33
|
+
if (result.client) {
|
|
34
|
+
const page = await fetch(`${server.server.url}/`);
|
|
35
|
+
if (!page.ok || !(await page.text()).includes("<div id=\"root\""))
|
|
36
|
+
throw new FeltKitError("UNAVAILABLE", "The production build did not serve the frontend.");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
finally {
|
|
40
|
+
await server.close();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
if (previous.state === undefined)
|
|
45
|
+
delete process.env.FELTKIT_STATE_DIR;
|
|
46
|
+
else
|
|
47
|
+
process.env.FELTKIT_STATE_DIR = previous.state;
|
|
48
|
+
if (previous.url !== undefined)
|
|
49
|
+
process.env.FELTDB_URL = previous.url;
|
|
50
|
+
rmSync(scratch, { recursive: true, force: true });
|
|
51
|
+
}
|
|
52
|
+
const stamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
53
|
+
const dir = resolve(options.out ?? join(projectDir, ".feltkit", "deploy", `${result.application}-${stamp}`));
|
|
54
|
+
if (existsSync(dir))
|
|
55
|
+
throw new FeltKitError("CONFIGURATION", `${dir} already exists; choose another --out.`);
|
|
56
|
+
mkdirSync(dir, { recursive: true });
|
|
57
|
+
cpSync(join(projectDir, BUILD_DIR), join(dir, BUILD_DIR), { recursive: true });
|
|
58
|
+
if (result.client)
|
|
59
|
+
cpSync(result.client, join(dir, "dist", "client"), { recursive: true });
|
|
60
|
+
const runtimeDeps = Object.fromEntries(Object.entries({ ...(pkg.dependencies ?? {}) }).filter(([name]) => !["react", "react-dom"].includes(name)));
|
|
61
|
+
writeFileSync(join(dir, "package.json"), `${JSON.stringify({
|
|
62
|
+
name: `${pkg.name ?? result.application}-deploy`,
|
|
63
|
+
private: true,
|
|
64
|
+
version: pkg.version ?? "0.0.0",
|
|
65
|
+
type: "module",
|
|
66
|
+
engines: { node: ">=20.11" },
|
|
67
|
+
scripts: { start: "feltkit start" },
|
|
68
|
+
dependencies: runtimeDeps,
|
|
69
|
+
...(pkg.overrides ? { overrides: pkg.overrides } : {}),
|
|
70
|
+
}, null, 2)}\n`);
|
|
71
|
+
if (existsSync(join(projectDir, "package-lock.json")))
|
|
72
|
+
cpSync(join(projectDir, "package-lock.json"), join(dir, "package-lock.json"));
|
|
73
|
+
writeFileSync(join(dir, "Dockerfile"), `FROM node:22-slim
|
|
74
|
+
WORKDIR /app
|
|
75
|
+
COPY package*.json ./
|
|
76
|
+
RUN npm install --omit=dev --no-audit --no-fund
|
|
77
|
+
COPY . .
|
|
78
|
+
ENV NODE_ENV=production PORT=3000 FELTKIT_STATE_DIR=/data/state
|
|
79
|
+
VOLUME ["/data"]
|
|
80
|
+
EXPOSE 3000
|
|
81
|
+
USER node
|
|
82
|
+
# node directly (not npx), so SIGTERM reaches FeltKit and it shuts down cleanly.
|
|
83
|
+
CMD ["node", "node_modules/feltkit/bin/feltkit.js", "start", "--host", "0.0.0.0"]
|
|
84
|
+
`);
|
|
85
|
+
writeFileSync(join(dir, ".dockerignore"), "node_modules\n.feltkit/production\n");
|
|
86
|
+
writeFileSync(join(dir, "DEPLOY.md"), `# Deploying ${result.application}
|
|
87
|
+
|
|
88
|
+
Built with feltkit ${SDK_VERSION} on ${new Date().toISOString()}.
|
|
89
|
+
Verified: the production build booted against a temporary state directory and
|
|
90
|
+
answered /_feltkit/health${result.client ? " and served the frontend" : ""}.
|
|
91
|
+
|
|
92
|
+
## Run
|
|
93
|
+
|
|
94
|
+
npm install --omit=dev
|
|
95
|
+
PORT=3000 npm start
|
|
96
|
+
|
|
97
|
+
or
|
|
98
|
+
|
|
99
|
+
docker build -t ${result.application} .
|
|
100
|
+
docker run -p 3000:3000 -v ${result.application}-data:/data ${result.application}
|
|
101
|
+
|
|
102
|
+
## State (one FeltDB instance for the production environment)
|
|
103
|
+
|
|
104
|
+
| Setting | Effect |
|
|
105
|
+
|---|---|
|
|
106
|
+
| \`FELTDB_URL\` + \`FELTDB_TOKEN\` | Use a FeltDB server. The token comes from your secret manager; FeltKit never writes it to disk. |
|
|
107
|
+
| \`FELTKIT_STATE_DIR\` | Use a local, durable FeltDB directory (mount a volume). The Docker image defaults to \`/data/state\`. |
|
|
108
|
+
| neither | \`.feltkit/production/state\` beside the app. |
|
|
109
|
+
|
|
110
|
+
Run one process per environment. The local runtime is a single-host store.
|
|
111
|
+
|
|
112
|
+
## Identity
|
|
113
|
+
|
|
114
|
+
Production has no development sign-in. Either supply \`auth.authenticate\` in
|
|
115
|
+
\`feltkit({ ... })\` to verify requests with your identity provider, or issue
|
|
116
|
+
session tokens to known principals:
|
|
117
|
+
|
|
118
|
+
npx feltkit session create --env production --id ops-bot --type agent --role agent
|
|
119
|
+
|
|
120
|
+
The dashboard is not served in production. Setting \`FELTKIT_DASHBOARD=1\` serves it
|
|
121
|
+
behind the admin token in \`.feltkit/production/admin-token\`; data edits stay disabled.
|
|
122
|
+
`);
|
|
123
|
+
return { dir, application: result.application, build: result };
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=deploy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/cli/deploy.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1G,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvG,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAA6C;IACxE,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/C,MAAM,GAAG,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,CAAC;IAEvC,6EAA6E;IAC7E,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,uBAAuB,CAAC,CAAC,CAAC;IACrE,MAAM,QAAQ,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;IACvF,OAAO,CAAC,GAAG,CAAC,iBAAiB,GAAG,IAAI,CAAC,OA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;2BAEpC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,EAAE;;;;;;;;;sBASpD,MAAM,CAAC,WAAW;iCACP,MAAM,CAAC,WAAW,eAAe,MAAM,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;CAsBnF,CACE,CAAC;IACF,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface Parsed {
|
|
2
|
+
command: string | undefined;
|
|
3
|
+
positional: string[];
|
|
4
|
+
flags: Record<string, string | boolean>;
|
|
5
|
+
}
|
|
6
|
+
export declare function parseArgs(argv: string[]): Parsed;
|
|
7
|
+
export declare function main(argv?: string[]): Promise<number>;
|
|
8
|
+
export declare function run(): Promise<void>;
|
|
9
|
+
export {};
|