Skip to content

Commit

Permalink
chore(version): 1.0.0
Browse files Browse the repository at this point in the history
The first release of Celest V1!
  • Loading branch information
dnys1 committed Oct 14, 2024
1 parent 83e2240 commit 0872a6b
Show file tree
Hide file tree
Showing 54 changed files with 332 additions and 270 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/celest_cloud_auth.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: celest_cloud_auth
on:
pull_request:
paths:
- ".github/workflows/celest_cloud_auth.yaml"
- "services/celest_cloud_auth/**"

# Prevent duplicate runs due to Graphite
# https://graphite.dev/docs/troubleshooting#why-are-my-actions-running-twice
concurrency:
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}-${{ github.ref == 'refs/heads/main' && github.sha || ''}}
cancel-in-progress: true

jobs:
analyze_and_format:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Git Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # 4.1.7
- name: Setup Flutter
uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # 2.16.0
with:
cache: true
- name: Setup Melos
run: dart pub global activate melos
- name: Get Packages
run: melos bootstrap
- name: Analyze
working-directory: services/celest_cloud_auth
run: dart analyze
- name: Format
working-directory: services/celest_cloud_auth
run: dart format --set-exit-if-changed .
test:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Git Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # 4.1.7
- name: Setup Flutter
uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # 2.16.0
with:
cache: true
- name: Setup Melos
run: dart pub global activate melos
- name: Get Packages
run: melos bootstrap
- name: Test
working-directory: services/celest_cloud_auth
run: dart test
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,17 @@ You have now set up your Celest project and integrated it into your Flutter app.
| Package | Description | Pub | Checks |
| -------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [celest](packages/celest/) | The main package for defining Celest backends. | <a href="https://pub.dev/packages/celest" target="_blank"> <img src="https://img.shields.io/pub/v/celest.svg"></a> | [![Celest](https://github.com/celest-dev/celest/actions/workflows/celest.yaml/badge.svg)](https://github.com/celest-dev/celest/actions/workflows/celest.yaml) |
| [celest_ast](packages/celest_ast/) | A structured representation of Celest projects. | <a href="https://pub.dev/packages/celest_ast" target="_blank"> <img src="https://img.shields.io/pub/v/celest_ast.svg"></a> | [![Celest AST](https://github.com/celest-dev/celest/actions/workflows/celest_ast.yaml/badge.svg)](https://github.com/celest-dev/celest/actions/workflows/celest_ast.yaml) |
| [celest_ast](packages/celest_ast/) | A structured representation of Celest projects. | <a href="https://pub.dev/packages/celest_ast" target="_blank"> <img src="https://img.shields.io/pub/v/celest_ast.svg"></a> | [![Celest AST](https://github.com/celest-dev/celest/actions/workflows/celest_ast.yaml/badge.svg)](https://github.com/celest-dev/celest/actions/workflows/celest_ast.yaml) |
| [celest_auth](packages/celest_auth/) | The authentication and authorization runtimes for Celest. | <a href="https://pub.dev/packages/celest_auth" target="_blank"> <img src="https://img.shields.io/pub/v/celest_auth.svg"></a> | [![Celest Auth](https://github.com/celest-dev/celest/actions/workflows/celest_auth.yaml/badge.svg)](https://github.com/celest-dev/celest/actions/workflows/celest_auth.yaml) |
| [celest_cloud](packages/celest_cloud/) | API contracts and Dart clients for the Celest Cloud platform. | <a href="https://pub.dev/packages/celest_cloud" target="_blank"> <img src="https://img.shields.io/pub/v/celest_cloud.svg"></a> | [![Celest Cloud](https://github.com/celest-dev/celest/actions/workflows/celest_cloud.yaml/badge.svg)](https://github.com/celest-dev/celest/actions/workflows/celest_cloud.yaml) |
| [celest_core](packages/celest_core/) | Core types and utilities shared between Celest packages. | <a href="https://pub.dev/packages/celest_core" target="_blank"> <img src="https://img.shields.io/pub/v/celest_core.svg"></a> | [![Celest Core](https://github.com/celest-dev/celest/actions/workflows/celest_core.yaml/badge.svg)](https://github.com/celest-dev/celest/actions/workflows/celest_core.yaml) |

## Services

| Service | Description | Pub | Checks |
| ------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [celest_cloud_auth](packages/celest_cloud_auth/) | A Dart-native authentication and authorization solution built on [Cedar](https://github.com/celest-dev/cedar-dart) and Celest Data. | <a href="https://pub.dev/packages/celest_cloud_auth" target="_blank"> <img src="https://img.shields.io/pub/v/celest_cloud_auth.svg"></a> | [![Celest Cloud Auth](https://github.com/celest-dev/celest/actions/workflows/celest_cloud_auth.yaml/badge.svg)](https://github.com/celest-dev/celest/actions/workflows/celest_cloud_auth.yaml) |

## License

This repo is licensed under the [BSD-2-Clause-Patent](https://spdx.org/licenses/BSD-2-Clause-Patent.html) license. See [LICENSE.md](LICENSE.md) for the full text.
Expand Down
Binary file added assets/analyzer-plugin.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/gemini/celest/client/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ environment:
sdk: ^3.4.0

dependencies:
celest: ^1.0.0-0
celest: ^1.0.0
celest_backend:
path: ..
celest_core: ^1.0.0-0
celest_core: ^1.0.0
http: ^1.0.0
meta: ^1.12.0
native_storage: ^0.2.2
Expand Down
Empty file.
1 change: 0 additions & 1 deletion examples/gemini/celest/functions

This file was deleted.

1 change: 0 additions & 1 deletion examples/gemini/celest/project.dart

This file was deleted.

4 changes: 2 additions & 2 deletions examples/gemini/celest/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ environment:
sdk: ^3.4.0

dependencies:
celest: ^1.0.0-0
celest: ^1.0.0
celest_ast: ^0.1.0
celest_core: ^1.0.0-0
celest_core: ^1.0.0
google_generative_ai: ^0.2.0
http: '>=0.13.0 <2.0.0'
meta: ^1.12.0
Expand Down
4 changes: 2 additions & 2 deletions examples/openai/celest/client/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ environment:
sdk: ^3.4.0

dependencies:
celest: ^1.0.0-0
celest: ^1.0.0
celest_backend:
path: ..
celest_core: ^1.0.0-0
celest_core: ^1.0.0
http: ^1.0.0
meta: ^1.12.0
native_storage: ^0.2.2
Expand Down
Empty file.
1 change: 0 additions & 1 deletion examples/openai/celest/functions

This file was deleted.

1 change: 0 additions & 1 deletion examples/openai/celest/project.dart

This file was deleted.

4 changes: 2 additions & 2 deletions examples/openai/celest/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ environment:
sdk: ^3.4.0

dependencies:
celest: ^1.0.0-0
celest: ^1.0.0
celest_ast: ^0.1.0
celest_core: ^1.0.0-0
celest_core: ^1.0.0
chat_gpt_sdk: ^2.2.8
http: '>=0.13.0 <2.0.0'
meta: ^1.12.0
Expand Down
22 changes: 0 additions & 22 deletions examples/tasks/celest/client/lib/src/functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import 'package:celest_core/celest_core.dart' as _$celest;
import 'package:celest_core/src/exception/cloud_exception.dart' as _$celest;
import 'package:celest_core/src/exception/serialization_exception.dart'
as _$celest;
import 'package:drift/src/remote/communication.dart' as _$drift_communication;
import 'package:drift/src/runtime/cancellation_zone.dart'
as _$drift_cancellation_zone;
import 'package:drift/src/runtime/exceptions.dart' as _$drift_exceptions;
Expand All @@ -27,8 +26,6 @@ import 'package:google_cloud/src/bad_request_exception.dart'
import 'package:hrana/src/exception.dart' as _$hrana_exception;
import 'package:http/src/exception.dart' as _$http_exception;
import 'package:shelf/src/hijack_exception.dart' as _$shelf_hijack_exception;
import 'package:sqlite3/src/exception.dart' as _$sqlite3_exception;
import 'package:sqlite3/src/vfs.dart' as _$sqlite3_vfs;
import 'package:tasks_client/tasks_client.dart';

class CelestFunctions {
Expand Down Expand Up @@ -406,32 +403,13 @@ class CelestFunctionsTasks {
errorValue),
stackTrace,
);
case 'sqlite3.SqliteException':
Error.throwWithStackTrace(
_$celest.Serializers.instance
.deserialize<_$sqlite3_exception.SqliteException>(errorValue),
stackTrace,
);
case 'drift.CancellationException':
Error.throwWithStackTrace(
_$celest.Serializers.instance
.deserialize<_$drift_cancellation_zone.CancellationException>(
errorValue),
stackTrace,
);
case 'drift.ConnectionClosedException':
Error.throwWithStackTrace(
_$celest.Serializers.instance
.deserialize<_$drift_communication.ConnectionClosedException>(
errorValue),
stackTrace,
);
case 'sqlite3.VfsException':
Error.throwWithStackTrace(
_$celest.Serializers.instance
.deserialize<_$sqlite3_vfs.VfsException>(errorValue),
stackTrace,
);
case 'hrana.ConnectionClosed':
Error.throwWithStackTrace(
_$celest.Serializers.instance
Expand Down
46 changes: 0 additions & 46 deletions examples/tasks/celest/client/lib/src/serializers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import 'package:celest_core/src/exception/cloud_exception.dart' as _$celest;
import 'package:celest_core/src/exception/serialization_exception.dart'
as _$celest;
import 'package:celest_core/src/serialization/json_value.dart' as _$celest;
import 'package:drift/src/remote/communication.dart' as _$drift_communication;
import 'package:drift/src/runtime/cancellation_zone.dart'
as _$drift_cancellation_zone;
import 'package:drift/src/runtime/exceptions.dart' as _$drift_exceptions;
Expand All @@ -24,8 +23,6 @@ import 'package:google_cloud/src/bad_request_exception.dart'
import 'package:hrana/src/exception.dart' as _$hrana_exception;
import 'package:http/src/exception.dart' as _$http_exception;
import 'package:shelf/src/hijack_exception.dart' as _$shelf_hijack_exception;
import 'package:sqlite3/src/exception.dart' as _$sqlite3_exception;
import 'package:sqlite3/src/vfs.dart' as _$sqlite3_vfs;

void initSerializers({_$celest.Serializers? serializers}) {
return runZoned(
Expand Down Expand Up @@ -899,14 +896,6 @@ void initSerializers({_$celest.Serializers? serializers}) {
),
const _$celest.TypeToken<_$celest.JsonValue?>('JsonValue'),
);
_$celest.Serializers.instance.put(_$celest.Serializer.define<
_$drift_communication.ConnectionClosedException,
Map<String, Object?>?>(
serialize: ($value) => const <String, Object?>{},
deserialize: ($serialized) {
return _$drift_communication.ConnectionClosedException();
},
));
_$celest.Serializers.instance.put(_$celest.Serializer.define<
_$drift_cancellation_zone.CancellationException,
Map<String, Object?>?>(
Expand Down Expand Up @@ -1031,41 +1020,6 @@ void initSerializers({_$celest.Serializers? serializers}) {
return _$shelf_hijack_exception.HijackException();
},
));
_$celest.Serializers.instance.put(_$celest.Serializer.define<
_$sqlite3_exception.SqliteException, Map<String, Object?>>(
serialize: ($value) => <String, Object?>{
r'message': $value.message,
if ($value.explanation case final explanation?)
r'explanation': explanation,
r'extendedResultCode': $value.extendedResultCode,
r'resultCode': $value.resultCode,
if ($value.operation case final operation?) r'operation': operation,
if ($value.causingStatement case final causingStatement?)
r'causingStatement': causingStatement,
if ($value.parametersToStatement case final parametersToStatement?)
r'parametersToStatement': parametersToStatement,
},
deserialize: ($serialized) {
return _$sqlite3_exception.SqliteException(
($serialized[r'extendedResultCode'] as num).toInt(),
($serialized[r'message'] as String),
($serialized[r'explanation'] as String?),
($serialized[r'causingStatement'] as String?),
($serialized[r'parametersToStatement'] as Iterable<Object?>?)
?.toList(),
($serialized[r'operation'] as String?),
);
},
));
_$celest.Serializers.instance.put(_$celest.Serializer.define<
_$sqlite3_vfs.VfsException, Map<String, Object?>>(
serialize: ($value) =>
<String, Object?>{r'returnCode': $value.returnCode},
deserialize: ($serialized) {
return _$sqlite3_vfs.VfsException(
($serialized[r'returnCode'] as num).toInt());
},
));
},
zoneValues: {_$celest.Serializers: serializers},
);
Expand Down
4 changes: 2 additions & 2 deletions examples/tasks/celest/client/lib/tasks_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ enum CelestEnvironment {

Uri get baseUri => switch (this) {
local => _$celest.kIsWeb || !Platform.isAndroid
? Uri.parse('http://localhost:56902')
: Uri.parse('http://10.0.2.2:56902'),
? Uri.parse('http://localhost:56903')
: Uri.parse('http://10.0.2.2:56903'),
};
}

Expand Down
4 changes: 2 additions & 2 deletions examples/tasks/celest/client/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ environment:
sdk: ^3.4.0

dependencies:
celest: ^1.0.0-0
celest: ^1.0.0
celest_backend:
path: ..
celest_core: ^1.0.0-0
celest_core: ^1.0.0
http: ^1.0.0
native_storage: ^0.2.2

Expand Down
44 changes: 2 additions & 42 deletions examples/tasks/celest/lib/src/generated/data.celest.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ library;

import 'package:celest/celest.dart';
import 'package:celest/src/core/context.dart';
import 'package:celest/src/runtime/data/connect.dart';
import 'package:celest_backend/src/database/task_database.dart';
import 'package:drift/native.dart';
import 'package:drift/src/runtime/api/runtime_api.dart';
import 'package:drift/src/runtime/executor/executor.dart';
import 'package:drift_hrana/drift_hrana.dart';

/// The data services for the Celest backend.
///
Expand All @@ -23,7 +20,7 @@ class CelestData {
static Future<void> init(Context context) async {
context.put(
_tasksDatabaseKey,
await _connect(
await connect(
context,
name: 'TaskDatabase',
factory: TaskDatabase.new,
Expand All @@ -40,40 +37,3 @@ class CelestData {
static ContextKey<TaskDatabase> get _tasksDatabaseKey =>
const ContextKey('TaskDatabase');
}

/// Checks the connection to the database by running a simple query.
Future<Database> _checkConnection<Database extends GeneratedDatabase>(
Database db) async {
await db.transaction(() async {
await db.customSelect('SELECT 1').get();
});
return db;
}

/// Constructs a new [Database] and connects to it using the provided
/// [hostnameVariable] and [tokenSecret] configuration values.
Future<Database> _connect<Database extends GeneratedDatabase>(
Context context, {
required String name,
required Database Function(QueryExecutor) factory,
required env hostnameVariable,
required secret tokenSecret,
}) async {
if (context.environment == Environment.local) {
return _checkConnection(factory(NativeDatabase.memory()));
}
final host = context.get(hostnameVariable);
final token = context.get(tokenSecret);
if (host == null || token == null) {
throw StateError(
'Missing database hostname or token for $name. '
'Please set the `$hostnameVariable` and `$tokenSecret` values '
'in the environment or Celest configuration file.',
);
}
final connector = HranaDatabase(
Uri(scheme: 'libsql', host: host),
jwtToken: token,
);
return _checkConnection(factory(connector));
}
4 changes: 1 addition & 3 deletions examples/tasks/celest/lib/src/project.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import 'package:celest/celest.dart';
import 'package:celest_backend/src/database/task_database.dart';

const project = Project(
name: 'tasks',
);
const project = Project(name: 'tasks');

const tasksDatabase = Database(
schema: Schema.drift(TaskDatabase),
Expand Down
4 changes: 2 additions & 2 deletions examples/tasks/celest/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ environment:
sdk: ^3.4.0

dependencies:
celest: ^1.0.0-0
celest_core: ^1.0.0-0
celest: ^1.0.0
celest_core: ^1.0.0
drift: ^2.20.3
drift_hrana: ^1.0.2
meta: ^1.12.0
Expand Down
Binary file added examples/tasks/web/sqlite3.wasm
Binary file not shown.
Loading

0 comments on commit 0872a6b

Please sign in to comment.