@layers/amba 4.0.4 → 4.1.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/README.md +3 -3
- package/dist/api-client.d.ts +4 -1
- package/dist/commands/collections.d.ts +55 -0
- package/dist/commands/functions-logs.d.ts +11 -0
- package/dist/commands/monetization.d.ts +14 -4
- package/dist/commands/ship.d.ts +47 -0
- package/dist/index.js +1391 -57
- package/dist/ship/config.d.ts +98 -0
- package/dist/ship/exec.d.ts +53 -0
- package/dist/ship/orchestrator.d.ts +52 -0
- package/dist/ship/phases.d.ts +87 -0
- package/dist/ship/state.d.ts +52 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Amba is the agent-native backend-as-a-service for mobile and web apps. This pack
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install -g @layers/amba
|
|
8
|
+
npm install -g @layers/amba
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
…or run on demand:
|
|
@@ -50,10 +50,10 @@ amba login # browser-based auth (skip with --token / AMBA_PAT)
|
|
|
50
50
|
amba projects list
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
Check the project is live:
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
|
-
amba
|
|
56
|
+
amba status --detailed
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
## Common commands
|
package/dist/api-client.d.ts
CHANGED
|
@@ -384,12 +384,15 @@ export interface FunctionLogsResponse {
|
|
|
384
384
|
truncated: boolean;
|
|
385
385
|
since: string;
|
|
386
386
|
until: string;
|
|
387
|
+
/** Present when `since_request_id` anchored the range — the anchor event's timestamp. */
|
|
388
|
+
anchor?: string;
|
|
387
389
|
}
|
|
388
390
|
export declare function getFunctionLogs(projectId: string, functionName: string, options?: {
|
|
389
391
|
since?: string;
|
|
390
392
|
until?: string;
|
|
391
393
|
limit?: number;
|
|
392
394
|
requestId?: string;
|
|
395
|
+
sinceRequestId?: string;
|
|
393
396
|
}): Promise<ApiResponse<FunctionLogsResponse>>;
|
|
394
397
|
export interface QueueBinding {
|
|
395
398
|
queue_name: string;
|
|
@@ -476,7 +479,7 @@ export declare function deleteSecretViaApi(projectId: string, name: string, opti
|
|
|
476
479
|
deleted: true;
|
|
477
480
|
}>>;
|
|
478
481
|
/** Closed set of column types the server accepts. */
|
|
479
|
-
export type CollectionColumnType = 'uuid' | 'text' | 'integer' | 'bigint' | 'numeric' | 'boolean' | 'timestamptz' | 'date' | 'jsonb' | 'vector';
|
|
482
|
+
export type CollectionColumnType = 'uuid' | 'text' | 'integer' | 'bigint' | 'numeric' | 'boolean' | 'timestamptz' | 'date' | 'jsonb' | 'vector' | 'text[]' | 'integer[]' | 'bigint[]' | 'numeric[]' | 'boolean[]' | 'uuid[]';
|
|
480
483
|
export interface CollectionColumn {
|
|
481
484
|
name: string;
|
|
482
485
|
type: CollectionColumnType;
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
* Multi-op alters are issued sequentially so the operator audit trail
|
|
21
21
|
* stays one-to-one with developer actions.
|
|
22
22
|
*/
|
|
23
|
+
import { type CollectionColumn, type CollectionIndex } from '../api-client.js';
|
|
23
24
|
export interface CollectionsCreateOptions {
|
|
24
25
|
/** Field specs in `name:type[:nullable]` form. May repeat. */
|
|
25
26
|
field: string[];
|
|
@@ -46,3 +47,57 @@ export declare function collectionsListCommand(): Promise<void>;
|
|
|
46
47
|
export declare function collectionsDropCommand(name: string, options?: {
|
|
47
48
|
confirm?: string;
|
|
48
49
|
}): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Parse a `--field` spec into a `CollectionColumn`.
|
|
52
|
+
*
|
|
53
|
+
* Accepted grammars:
|
|
54
|
+
*
|
|
55
|
+
* 1. **Plain column:** `name:type[:nullable]`
|
|
56
|
+
* Examples: `letter_id:uuid`, `parsed:jsonb:nullable`, `tags:text[]`,
|
|
57
|
+
* `scores:integer[]:nullable`. Array types (`text[]`, `integer[]`,
|
|
58
|
+
* `bigint[]`, `numeric[]`, `boolean[]`, `uuid[]`) follow the same
|
|
59
|
+
* grammar as scalars and unlock the contains/containedBy/overlaps
|
|
60
|
+
* query operators.
|
|
61
|
+
*
|
|
62
|
+
* 2. **Foreign key:** `name:type:fk(<table>[.<column>][:onDelete])`
|
|
63
|
+
* Examples:
|
|
64
|
+
* `plan_id:uuid:fk(plans)` — references `plans(id)`, default no-action
|
|
65
|
+
* `plan_id:uuid:fk(plans.id)` — explicit column
|
|
66
|
+
* `plan_id:uuid:fk(plans.id:cascade)` — ON DELETE CASCADE
|
|
67
|
+
* `parent_id:uuid:fk(comments:set_null)` — ON DELETE SET NULL
|
|
68
|
+
*
|
|
69
|
+
* Note: a `user_id` FK to `app_users(id)` is auto-emitted on every
|
|
70
|
+
* collection server-side. Customers don't need to declare it.
|
|
71
|
+
*
|
|
72
|
+
* 3. **Vector:** `name:vector:<dim>` or `name:vector(<dim>)`
|
|
73
|
+
* Examples:
|
|
74
|
+
* `embedding:vector:1536` — OpenAI text-embedding-3-small
|
|
75
|
+
* `embedding:vector(384)` — sentence-transformers / all-MiniLM
|
|
76
|
+
* Dimension is validated client-side as 1..4096. For an HNSW /
|
|
77
|
+
* IVFFlat index on the column, supply `--index 'embedding'`
|
|
78
|
+
* separately.
|
|
79
|
+
*
|
|
80
|
+
* 4. **Vector + nullable:** `name:vector:<dim>:nullable`
|
|
81
|
+
* Vector columns can be nullable for "embedding generated lazily".
|
|
82
|
+
*
|
|
83
|
+
* Multi-arg combinations (e.g. fk + nullable on the same column) parse
|
|
84
|
+
* left-to-right: the third segment is the FK / vector / nullable
|
|
85
|
+
* marker; if it's an FK or vector, the optional fourth segment is
|
|
86
|
+
* `nullable`. Plain columns put `nullable` in slot 3.
|
|
87
|
+
*
|
|
88
|
+
* Exported for tests.
|
|
89
|
+
*/
|
|
90
|
+
export declare function parseColumnSpec(spec: string): CollectionColumn;
|
|
91
|
+
/**
|
|
92
|
+
* Parse an index spec into the wire shape data's API expects.
|
|
93
|
+
*
|
|
94
|
+
* Input syntax (CLI-friendly): `"col1 [asc|desc], col2 [asc|desc]"`.
|
|
95
|
+
* Wire shape (per data's contract): `{ columns: ['col1 desc', 'col2 asc'] }` —
|
|
96
|
+
* direction is embedded in each column string and parsed by the DDL emit.
|
|
97
|
+
*
|
|
98
|
+
* Bare column names (no direction) are passed through verbatim; the
|
|
99
|
+
* default sort direction is the DDL emit's responsibility.
|
|
100
|
+
*
|
|
101
|
+
* Exported for tests.
|
|
102
|
+
*/
|
|
103
|
+
export declare function parseIndexSpec(spec: string): CollectionIndex;
|
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
* - `--tail`: print the last hour's events, then poll every 3s for
|
|
7
7
|
* new events past the highest seen `EventTimestampMs`. Ctrl+C to stop.
|
|
8
8
|
*
|
|
9
|
+
* `--since-request-id <r_...>` anchors the range start at the oldest event
|
|
10
|
+
* mentioning that request id ("show me everything from this request
|
|
11
|
+
* onward") — the server resolves the anchor; works in both modes.
|
|
12
|
+
*
|
|
9
13
|
* Output formatting:
|
|
10
14
|
* - `--json`: NDJSON to stdout (one event per line) so `| jq` works.
|
|
11
15
|
* - default: human-readable lines:
|
|
@@ -28,5 +32,12 @@ export interface FunctionsLogsOptions {
|
|
|
28
32
|
json?: boolean;
|
|
29
33
|
/** Only show events whose log/exception text mentions this request id (`r_...`). */
|
|
30
34
|
requestId?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Anchor the range start at the oldest event mentioning this request id
|
|
37
|
+
* ("everything from this request onward"). Searched within the last 24h
|
|
38
|
+
* (or within --since/--until when given). Composes with --requestId, which
|
|
39
|
+
* filters instead of anchoring. Works with --tail (anchors the backfill).
|
|
40
|
+
*/
|
|
41
|
+
sinceRequestId?: string;
|
|
31
42
|
}
|
|
32
43
|
export declare function functionsLogsCommand(functionName: string, options?: FunctionsLogsOptions): Promise<void>;
|
|
@@ -13,10 +13,20 @@
|
|
|
13
13
|
* so the next plan is a no-op. Writes ONLY Amba's
|
|
14
14
|
* own state — never the provider. Idempotent.
|
|
15
15
|
* amba monetization apply — push the declared config to the provider.
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* DURABLE: the API returns a pollable
|
|
17
|
+
* operation_id and the CLI polls it to a
|
|
18
|
+
* terminal state. Additive changes apply
|
|
19
|
+
* automatically; destructive changes run only
|
|
20
|
+
* behind --confirm (which approves the exact
|
|
21
|
+
* plan_hash — a pending apply awaiting
|
|
22
|
+
* confirmation is approved by re-running with
|
|
23
|
+
* --confirm). STORE-PRODUCT steps (creating
|
|
24
|
+
* declared products in the provider and, for
|
|
25
|
+
* App Store products with push intent, in App
|
|
26
|
+
* Store Connect) ALWAYS wait for an explicit
|
|
27
|
+
* approval of the started apply — an up-front
|
|
28
|
+
* --confirm never auto-runs them. Refuses if
|
|
29
|
+
* the provider drifted since the plan.
|
|
20
30
|
*
|
|
21
31
|
* Project is resolved via `loadProjectConfig` — same pattern as the other
|
|
22
32
|
* project-scoped CLI commands.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `amba ship` — take this Expo app from code-complete to live on the App Store
|
|
3
|
+
* and Google Play, and `amba ship init` to scaffold its config.
|
|
4
|
+
*
|
|
5
|
+
* amba ship run the full pipeline (preflight → monetization →
|
|
6
|
+
* build → submit → metadata → release)
|
|
7
|
+
* amba ship --phase build run a single phase
|
|
8
|
+
* amba ship --dry-run print the plan; touch nothing
|
|
9
|
+
* amba ship init scaffold amba.ship.json
|
|
10
|
+
*
|
|
11
|
+
* Build/submit/release shell out to `eas` (the Expo toolchain owns the build,
|
|
12
|
+
* the signing credentials, and the store submit). Monetization delegates to the
|
|
13
|
+
* Amba control plane (`amba monetization`). Steps no API can do — create the
|
|
14
|
+
* store app record, the Apple Paid-Apps agreement, screenshots, store review —
|
|
15
|
+
* are detected and surfaced as manual gates with the exact console action.
|
|
16
|
+
*/
|
|
17
|
+
import { type ShipConfig } from '../ship/config.js';
|
|
18
|
+
import { type Executor } from '../ship/exec.js';
|
|
19
|
+
export interface ShipCommandOptions {
|
|
20
|
+
phase?: string;
|
|
21
|
+
platform?: string;
|
|
22
|
+
dryRun?: boolean;
|
|
23
|
+
force?: boolean;
|
|
24
|
+
config?: string;
|
|
25
|
+
}
|
|
26
|
+
/** Test seam: override the cloud-touching + clock dependencies. */
|
|
27
|
+
export interface ShipCommandDeps {
|
|
28
|
+
exec?: Executor;
|
|
29
|
+
resolveProjectId?: () => Promise<string | null>;
|
|
30
|
+
adminGet?: <T>(path: string) => Promise<{
|
|
31
|
+
data: T;
|
|
32
|
+
}>;
|
|
33
|
+
now?: () => string;
|
|
34
|
+
sleep?: (ms: number) => Promise<void>;
|
|
35
|
+
stateBaseDir?: string;
|
|
36
|
+
releasePollMs?: number;
|
|
37
|
+
releaseMaxWaitMs?: number;
|
|
38
|
+
}
|
|
39
|
+
/** Read + parse + validate a ship config file. Throws with every error joined. */
|
|
40
|
+
export declare function loadShipConfig(file: string): Promise<ShipConfig>;
|
|
41
|
+
export declare function shipCommand(options?: ShipCommandOptions, deps?: ShipCommandDeps): Promise<void>;
|
|
42
|
+
export interface ShipInitOptions {
|
|
43
|
+
config?: string;
|
|
44
|
+
force?: boolean;
|
|
45
|
+
slug?: string;
|
|
46
|
+
}
|
|
47
|
+
export declare function shipInitCommand(options?: ShipInitOptions): Promise<void>;
|