@layers/amba 0.1.1 → 1.0.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 CHANGED
@@ -175,7 +175,7 @@
175
175
 
176
176
  END OF TERMS AND CONDITIONS
177
177
 
178
- Copyright 2026 AppMachina
178
+ Copyright 2026 Layers
179
179
 
180
180
  Licensed under the Apache License, Version 2.0 (the "License");
181
181
  you may not use this file except in compliance with the License.
@@ -3,9 +3,9 @@
3
3
  *
4
4
  * Reads every collection schema for a project from the admin API and
5
5
  * emits a single `.amba/types.d.ts` declaration body that augments the
6
- * `@layers/amba-client` and `@layers/amba-functions` modules so
7
- * `Amba.collections.<name>`, `client.collections.<name>`, and
8
- * `ctx.collections.<name>` are statically typed.
6
+ * Amba client SDK modules so `Amba.collections.<name>`,
7
+ * `client.collections.<name>`, and `ctx.collections.<name>` are
8
+ * statically typed.
9
9
  */
10
10
  export interface CodegenHttpClient {
11
11
  /** Minimal contract — the engine only needs GET. */
package/dist/index.js CHANGED
@@ -629,7 +629,7 @@ async function validateApiKey(apiKey) {
629
629
  * Generate AMBA.md project context file for AI agents.
630
630
  */
631
631
  function generateAmbaMarkdown(opts) {
632
- const sdkPackage = opts.framework === "expo" ? "@layers/amba-expo" : "@layers/amba-client";
632
+ const sdkPackage = opts.framework === "expo" ? "@layers/amba-expo" : opts.framework === "react-native" ? "@layers/amba-react-native" : "@layers/amba-web";
633
633
  const providerExample = opts.framework === "expo" ? `
634
634
  ### Client Setup
635
635
 
@@ -641,7 +641,7 @@ import { Amba } from '@layers/amba-expo';
641
641
 
642
642
  export default function RootLayout() {
643
643
  useEffect(() => {
644
- Amba.init({
644
+ Amba.configure({
645
645
  projectId: process.env.EXPO_PUBLIC_AMBA_PROJECT_ID!,
646
646
  apiKey: process.env.EXPO_PUBLIC_AMBA_API_KEY!,
647
647
  });
@@ -659,16 +659,16 @@ import { Amba } from '@layers/amba-expo';
659
659
  export default function MyComponent() {
660
660
  const onPress = async () => {
661
661
  // Track an event
662
- await Amba.track('lesson_completed', { lesson_id: '123' });
662
+ await Amba.events.track('lesson_completed', { lesson_id: '123' });
663
663
 
664
664
  // Sign in with Apple (requires expo-apple-authentication)
665
665
  await Amba.signInWithApple();
666
666
 
667
667
  // Read remote config
668
- const showBanner = Amba.configModule.get('show_promo_banner');
668
+ const showBanner = await Amba.config.fetch();
669
669
 
670
- // Read current streaks
671
- const streaks = await Amba.streaks.getAll();
670
+ // Email sign-in
671
+ await Amba.auth.signInWithEmail('user@example.com', 'hunter2');
672
672
  };
673
673
 
674
674
  // ...
@@ -677,23 +677,21 @@ export default function MyComponent() {
677
677
  ### Client Setup
678
678
 
679
679
  \`\`\`typescript
680
- import { Amba } from '@layers/amba-client';
680
+ import { Amba } from '${sdkPackage}';
681
681
 
682
- Amba.configure({
682
+ await Amba.configure({
683
683
  projectId: process.env.AMBA_PROJECT_ID!,
684
684
  apiKey: process.env.AMBA_API_KEY!,
685
685
  });
686
686
 
687
- await Amba.client.init();
688
-
689
687
  // Track an event
690
- await Amba.client.track('page_viewed', { page: '/pricing' });
688
+ await Amba.events.track('page_viewed', { page: '/pricing' });
691
689
 
692
- // Get remote config
693
- const config = Amba.client.config.get('feature_flags');
690
+ // Read remote config
691
+ const config = await Amba.config.fetch();
694
692
 
695
- // Auth
696
- await Amba.client.auth.signUpWithEmail('user@example.com', 'hunter2');
693
+ // Email sign-in
694
+ await Amba.auth.signInWithEmail('user@example.com', 'hunter2');
697
695
  \`\`\``;
698
696
  return `# Amba Project Context
699
697
 
@@ -749,7 +747,7 @@ amba config set <key> <value> # Set a config value
749
747
  * Generate .cursor/rules/amba.mdc Cursor rules file.
750
748
  */
751
749
  function generateCursorRules(opts) {
752
- const sdk = opts.framework === "expo" ? "@layers/amba-expo" : "@layers/amba-client";
750
+ const sdk = opts.framework === "expo" ? "@layers/amba-expo" : opts.framework === "react-native" ? "@layers/amba-react-native" : "@layers/amba-web";
753
751
  return `---
754
752
  description: Rules for working with the Amba SDK in this project
755
753
  globs: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"]
@@ -853,9 +851,9 @@ async function detectFramework(cwd) {
853
851
  function getSdkPackage(framework) {
854
852
  switch (framework) {
855
853
  case "expo": return "@layers/amba-expo";
856
- case "react-native": return "@layers/amba-client";
857
- case "web": return "@layers/amba-client";
858
- case "unknown": return "@layers/amba-client";
854
+ case "react-native": return "@layers/amba-react-native";
855
+ case "web": return "@layers/amba-web";
856
+ case "unknown": return "@layers/amba-web";
859
857
  }
860
858
  }
861
859
  async function writeExampleScaffold(cwd, framework, projectName) {
@@ -887,7 +885,7 @@ export function AmbaExample(): null {
887
885
  * Call Amba.init() once at application startup (after env is loaded).
888
886
  * Requires AMBA_PROJECT_ID + AMBA_API_KEY in your environment.
889
887
  */
890
- import { Amba } from '@layers/amba-client';
888
+ import { Amba } from '@layers/amba-web';
891
889
 
892
890
  export async function initAmba(): Promise<void> {
893
891
  await Amba.init({
@@ -2014,7 +2012,6 @@ async function exportUsers(projectId, opts) {
2014
2012
  }
2015
2013
  sink.write(chunk);
2016
2014
  }
2017
- if (pending.length > 0) sink.write(pending);
2018
2015
  await sink.close();
2019
2016
  if (process.stderr.isTTY) process.stderr.write("\n");
2020
2017
  if (resolvedPath) {
@@ -2222,7 +2219,9 @@ function renderJson(domains) {
2222
2219
  function renderTypescript(domains) {
2223
2220
  const lines = [
2224
2221
  "// Auto-generated by `amba schema export --format=typescript`.",
2225
- "// For the canonical types, import from the @layers/amba-client SDK.",
2222
+ "// For the canonical types, import from your Amba client SDK",
2223
+ "// (`@layers/amba-web`, `@layers/amba-expo`, `@layers/amba-react-native`,",
2224
+ "// or `@layers/amba-node`).",
2226
2225
  ""
2227
2226
  ];
2228
2227
  for (const d of domains) {
@@ -3117,8 +3116,8 @@ const HEADER_BANNER = `// .amba/types.d.ts
3117
3116
  // AUTO-GENERATED by \`amba types generate\` — do not edit by hand.
3118
3117
  //
3119
3118
  // This file is regenerated whenever you run the CLI. It declares one
3120
- // interface per customer collection and module-augments @layers/amba-client +
3121
- // @layers/amba-functions so \`Amba.collections.<name>\`, \`client.collections.<name>\`,
3119
+ // interface per customer collection and module-augments the Amba client
3120
+ // SDKs so \`Amba.collections.<name>\`, \`client.collections.<name>\`,
3122
3121
  // and \`ctx.collections.<name>\` (Worker side) are all statically typed.
3123
3122
  //
3124
3123
  // Commit OR gitignore at your discretion. The shape mirrors your current
@@ -3126,21 +3125,19 @@ const HEADER_BANNER = `// .amba/types.d.ts
3126
3125
  function emitDeclarations(collections, bannerTimestamp) {
3127
3126
  const banner = bannerTimestamp ? `${HEADER_BANNER}\n// Generated: ${bannerTimestamp}` : HEADER_BANNER;
3128
3127
  const interfaces = collections.map((c) => emitInterface(c)).join("\n\n");
3129
- const augmentClient = collections.length ? `
3130
- declare module '@layers/amba-client' {
3131
- interface CollectionsRoot {
3132
- ${collections.map((c) => ` readonly ${tsLiteralKey(c.name)}: import('@layers/amba-client').ClientCollection<Amba.collections.${tsTypeName(c.name)}>;`).join("\n")}
3133
- }
3134
- }
3135
- ` : "";
3136
- const augmentFunctions = collections.length ? `
3137
- declare module '@layers/amba-functions' {
3128
+ const augmentClient = collections.length ? [
3129
+ "@layers/amba-web",
3130
+ "@layers/amba-expo",
3131
+ "@layers/amba-react-native",
3132
+ "@layers/amba-node"
3133
+ ].map((pkg) => `
3134
+ declare module '${pkg}' {
3138
3135
  interface CollectionsRoot {
3139
- ${collections.map((c) => ` readonly ${tsLiteralKey(c.name)}: import('@layers/amba-functions').Collection<Amba.collections.${tsTypeName(c.name)}>;`).join("\n")}
3136
+ ${collections.map((c) => ` readonly ${tsLiteralKey(c.name)}: import('${pkg}').ClientCollection<Amba.collections.${tsTypeName(c.name)}>;`).join("\n")}
3140
3137
  }
3141
3138
  }
3142
- ` : "";
3143
- return `${banner}\n\nexport {};\n\ndeclare global {\n namespace Amba {\n namespace collections {\n${interfaces ? indent(interfaces, 6) : " // (no collections defined yet)"}\n }\n }\n}\n${augmentClient}${augmentFunctions}`;
3139
+ `).join("") : "";
3140
+ return `${banner}\n\nexport {};\n\ndeclare global {\n namespace Amba {\n namespace collections {\n${interfaces ? indent(interfaces, 6) : " // (no collections defined yet)"}\n }\n }\n}\n${augmentClient}`;
3144
3141
  }
3145
3142
  function emitInterface(c) {
3146
3143
  const fields = c.columns.map((col) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@layers/amba",
3
- "version": "0.1.1",
4
- "description": "amba — agent-native backend-as-a-service. Functions, collections, storage, AI gateway, email, queues, sites — one CLI, per-tenant Postgres + Cloudflare edge. `npx amba init` to start.",
3
+ "version": "1.0.0",
4
+ "description": "amba — agent-native backend-as-a-service. Functions, collections, storage, AI gateway, email, queues, sites — one CLI to spin up your project and ship to production. `npx @layers/amba init` to start.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "amba": "dist/index.js"
@@ -19,10 +19,11 @@
19
19
  "homepage": "https://amba.dev",
20
20
  "repository": {
21
21
  "type": "git",
22
- "url": "git+https://github.com/layers/amba-cli.git"
22
+ "url": "git+https://github.com/layers/amba.git",
23
+ "directory": "packages/cli"
23
24
  },
24
25
  "bugs": {
25
- "url": "https://github.com/layers/amba-cli/issues"
26
+ "url": "https://github.com/layers/amba/issues"
26
27
  },
27
28
  "license": "Apache-2.0",
28
29
  "keywords": [