-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
486 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Generated by Celest. This file should not be modified manually, but | ||
// it can be checked into version control. | ||
// ignore_for_file: type=lint, unused_local_variable, unnecessary_cast, unnecessary_import | ||
|
||
library; | ||
|
||
import 'package:celest/celest.dart'; | ||
|
||
@Deprecated('Use `env` instead.') | ||
typedef Env = env; | ||
|
||
abstract final class env { | ||
static const openAiToken = EnvironmentVariable(name: r'OPEN_AI_TOKEN'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: 1 | ||
transforms: | ||
- title: "Change '@Context.user' to '@principal' for accessing user data" | ||
date: 2024-05-28 | ||
element: | ||
uris: ["celest.dart"] | ||
field: user | ||
inClass: Context | ||
changes: | ||
- kind: replacedBy | ||
newElement: | ||
uris: ["celest.dart"] | ||
variable: principal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/// HTTP annotations for Celest Functions. | ||
/// | ||
/// See the [docs](https://celest.dev/docs/functions/http/customization) for | ||
/// usage and examples. | ||
library http; | ||
|
||
export 'src/functions/http/http.dart'; | ||
export 'src/functions/http/http_error.dart'; | ||
export 'src/functions/http/http_header.dart'; | ||
export 'src/functions/http/http_method.dart'; | ||
export 'src/functions/http/http_query.dart'; | ||
export 'src/functions/http/http_status.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import 'package:meta/meta_meta.dart'; | ||
|
||
/// Marks a function or library as a cloud API. | ||
/// | ||
/// Celest Functions are written as normal Dart functions in the `celest/functions` | ||
/// folder of your project. | ||
/// | ||
/// To turn a function into a cloud function, add the `@cloud` annotation: | ||
/// | ||
/// ```dart | ||
/// // A helper function (not a cloud function). | ||
/// String greet(String name) => 'Hello, $name!'; | ||
/// | ||
/// // A cloud function which exposes the greeting logic. | ||
/// @cloud | ||
/// Future<String> sayHello(Person person) async { | ||
/// return greet(person.name); | ||
/// } | ||
/// ``` | ||
/// | ||
/// For more information, see [Creating functions](https://celest.dev/docs/functions/creating-functions). | ||
const cloud = _Cloud(); | ||
|
||
@Target({TargetKind.function, TargetKind.library}) | ||
final class _Cloud { | ||
const _Cloud(); | ||
} | ||
|
||
/// Marks an extension type definition as a custom implementation or its | ||
/// representation type. | ||
/// | ||
/// Custom implementations can be used to redefine the behavior of a type | ||
/// in Celest by changing some aspects of its interface. The most common | ||
/// use case for custom implementations is to customize serialization logic | ||
/// for a type which you do not own. | ||
/// | ||
/// See the [docs](https://celest.dev/docs/functions/data-types#custom-implementations) for more information. | ||
const customOverride = _CustomOverride(); | ||
|
||
@Target({TargetKind.extensionType}) | ||
final class _CustomOverride { | ||
const _CustomOverride(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import 'package:celest/http.dart'; | ||
import 'package:meta/meta_meta.dart'; | ||
|
||
/// {@template celest.functions.http} | ||
/// HTTP configuration options for cloud functions. | ||
/// {@endtemplate} | ||
@Target({TargetKind.library, TargetKind.function}) | ||
final class http { | ||
/// {@macro celest.functions.http} | ||
const http({ | ||
this.method = HttpMethod.post, | ||
this.statusCode = HttpStatus.ok, | ||
}); | ||
|
||
/// The HTTP method this function supports. | ||
final HttpMethod method; | ||
|
||
/// The status code returned for a successful response. | ||
final HttpStatus statusCode; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import 'package:meta/meta_meta.dart'; | ||
|
||
/// {@template celest.http.http_error} | ||
/// Configures an HTTP error response for a cloud function. | ||
/// {@endtemplate} | ||
@Target({TargetKind.library, TargetKind.function}) | ||
final class httpError { | ||
/// {@macro celest.http.http_error} | ||
const httpError( | ||
this.statusCode, | ||
this.type, [ | ||
this.type1, | ||
this.type2, | ||
this.type3, | ||
this.type4, | ||
this.type5, | ||
this.type6, | ||
this.type7, | ||
]); | ||
|
||
/// The status code returned when any of the specified types are thrown. | ||
final int statusCode; | ||
|
||
/// The error type this configuration applies to. | ||
final Type type; | ||
|
||
/// Additional error type this configuration applies to. | ||
final Type? type1; | ||
|
||
/// Additional error type this configuration applies to. | ||
final Type? type2; | ||
|
||
/// Additional error type this configuration applies to. | ||
final Type? type3; | ||
|
||
/// Additional error type this configuration applies to. | ||
final Type? type4; | ||
|
||
/// Additional error type this configuration applies to. | ||
final Type? type5; | ||
|
||
/// Additional error type this configuration applies to. | ||
final Type? type6; | ||
|
||
/// Additional error type this configuration applies to. | ||
final Type? type7; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import 'package:meta/meta_meta.dart'; | ||
|
||
/// {@template celest.http.http_header} | ||
/// An HTTP header key. | ||
/// {@endtemplate} | ||
@Target({TargetKind.parameter}) | ||
final class httpHeader { | ||
/// {@macro celest.http.http_header} | ||
const httpHeader(this.name); | ||
|
||
/// The name of the HTTP header. | ||
final String name; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/// Supported HTTP methods in Celest. | ||
extension type const HttpMethod._(String method) implements String { | ||
/// `GET` | ||
static const get = HttpMethod._('GET'); | ||
|
||
/// `POST` | ||
static const post = HttpMethod._('POST'); | ||
|
||
/// `PUT` | ||
static const put = HttpMethod._('PUT'); | ||
|
||
/// `DELETE` | ||
static const delete = HttpMethod._('DELETE'); | ||
|
||
/// `PATCH` | ||
static const patch = HttpMethod._('PATCH'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import 'package:meta/meta_meta.dart'; | ||
|
||
/// {@template celest.functions.http.http_query} | ||
/// An HTTP query parameter key. | ||
/// {@endtemplate} | ||
@Target({TargetKind.parameter}) | ||
final class httpQuery { | ||
/// {@macro celest.functions.http.http_query} | ||
const httpQuery(this.name); | ||
|
||
/// The name of the HTTP query parameter. | ||
final String name; | ||
} |
Oops, something went wrong.