harperdb 4.1.2 → 4.2.0-alpha.6
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 +7 -5
- package/{custom_function_template → application-template}/LICENSE +2 -2
- package/application-template/README.md +15 -0
- package/application-template/config.yaml +18 -0
- package/application-template/package.json +6 -0
- package/application-template/resources.js +22 -0
- package/application-template/schema.graphql +7 -0
- package/bin/harperdb.js +69 -43
- package/bin/lite.js +31 -0
- package/config/yaml/defaultConfig.yaml +19 -3
- package/index.d.ts +4 -0
- package/index.js +17 -0
- package/json/systemSchema.json +16 -0
- package/launchServiceScripts/launchInstallNATSServer.js +4 -4
- package/launchServiceScripts/launchNatsIngestService.js +25 -13
- package/launchServiceScripts/launchNatsReplyService.js +25 -6
- package/launchServiceScripts/launchUpdateNodes4-0-0.js +25 -6
- package/package.json +29 -16
- package/resources/DatabaseTransaction.d.ts +34 -0
- package/resources/IterableEventQueue.d.ts +10 -0
- package/resources/databases.d.ts +268 -0
- package/resources/search.d.ts +13 -0
- package/resources/tracked.d.ts +36 -0
- package/resources/transaction.d.ts +19 -0
- package/resources/transactionBroadcast.d.ts +31 -0
- package/server/jobs/jobProcess.js +25 -13
- package/server/serverHelpers/contentTypes.d.ts +32 -0
- package/server/threads/threadServer.js +31 -0
- package/utility/scripts/restartHdb.js +25 -6
- package/custom_function_template/README.md +0 -162
- package/custom_function_template/helpers/example.js +0 -50
- package/custom_function_template/package.json +0 -6
- package/custom_function_template/routes/examples.js +0 -47
- package/custom_function_template/static/index.html +0 -21
- package/custom_function_template/static/resources/css/style.css +0 -41
- package/custom_function_template/static/resources/img/favicon.png +0 -0
- package/custom_function_template/static/resources/img/logo.png +0 -0
- package/server/threads/threadHTTPServer.js +0 -18
package/README.md
CHANGED
|
@@ -21,10 +21,12 @@ Every Installation of HarperDB can be administered online using HarperDB Studio.
|
|
|
21
21
|
|
|
22
22
|
[HarperDB Studio](https://studio.harperdb.io/sign-up)
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
### HarperDB APIs
|
|
25
|
+
|
|
26
|
+
The preferred way to interact with HarperDB for typical querying, accessing, and updating data (CRUD) operations is through the REST interface, described in the REST documentation.
|
|
27
|
+
|
|
28
|
+
The complete HarperDB Operations API documentation is available at api.harperdb.io, and provides important administrative functions. Generally it is recommended that use the RESTful interface as your primary interface for scalable and performant data interaction for building production applications, and the operations API for administrative purposes.
|
|
29
|
+
|
|
28
30
|
|
|
29
31
|
[API Reference](https://api.harperdb.io/)
|
|
30
32
|
## Documentation and Support
|
|
@@ -59,4 +61,4 @@ HarperDB will prompt you for configuration options during install, and then auto
|
|
|
59
61
|
|
|
60
62
|
***
|
|
61
63
|
|
|
62
|
-
|
|
64
|
+
e6defe9ab4b645cab1ced61c464f3d6e452e2788
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2023 HarperDB, Inc.
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# HarperDB Application Template
|
|
2
|
+
|
|
3
|
+
This is a template for building [HarperDB](https://www.harperdb.io/) applications. You can download this repository as a starting point for building applications with HarperDB. To get started, make sure you have [installed HarperDB](https://docs.harperdb.io/docs/install-harperdb), which can be quickly done with `npm install -g harperdb`. You can run your application from the directory where you downloaded the contents of this repository with:
|
|
4
|
+
|
|
5
|
+
`harperdb run /path/to/your-app`
|
|
6
|
+
|
|
7
|
+
(or if you enter that directory, you can run the current directory as `harperdb run .`).
|
|
8
|
+
|
|
9
|
+
For more information about getting started with HarperDB and building applications, see our getting started guide.
|
|
10
|
+
|
|
11
|
+
This template includes the [default configuration](./config.yaml), which specifies how files are handled in your application.
|
|
12
|
+
|
|
13
|
+
The [schema.graphql](./schema.graphql) is the schema definition. This is the main starting point for defining your database schema, specifying which tables you want and what attributes/fields they should have.
|
|
14
|
+
|
|
15
|
+
The [resources.js](./resources.js) provides a template for defining JavaScript resource classes, for customized application logic in your endpoints.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# This defines the configuration of this application. Each defines a (sub) component that is loaded and
|
|
2
|
+
# used for this application. These components can provide specific functionality and define how different
|
|
3
|
+
# files in your app are loaded.
|
|
4
|
+
REST: true # These provides the HTTP REST interface for all exported resources
|
|
5
|
+
graphqlSchema: # These reads GraphQL schemas to define the schema of database/tables/attributes.
|
|
6
|
+
files: '*.graphql' # looks for these files
|
|
7
|
+
# path: / # exported queries are on the root path by default
|
|
8
|
+
jsResource: # Loads JavaScript modules such that their exports are exported as resources
|
|
9
|
+
files: resources.js # the entry module for resources
|
|
10
|
+
# path: / # exported resources are on the root path by default, like http://server/resource-name
|
|
11
|
+
fastifyRoutes: # This loads files that define fastify routes using fastify's auto-loader
|
|
12
|
+
files: routes/*.js
|
|
13
|
+
path: . # relative to the app-name, like http://server/app-name/route-name
|
|
14
|
+
static: # This allows static files to be directly accessible
|
|
15
|
+
root: web
|
|
16
|
+
files: web/**
|
|
17
|
+
# login
|
|
18
|
+
#path: /
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Here we can define any JavaScript-based resources and extensions to tables
|
|
2
|
+
|
|
3
|
+
export class MyCustomResource extends tables.TableName {
|
|
4
|
+
// we can define our own custom POST handler
|
|
5
|
+
post(content) {
|
|
6
|
+
// do something with the incoming content;
|
|
7
|
+
return super.post(content);
|
|
8
|
+
}
|
|
9
|
+
// or custom GET handler
|
|
10
|
+
get() {
|
|
11
|
+
// we can modify this resource before returning
|
|
12
|
+
return super.get();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
*/
|
|
16
|
+
// we can also define a custom resource without a specific table
|
|
17
|
+
export class Greeting extends Resource {
|
|
18
|
+
// a "Hello, world!" handler
|
|
19
|
+
get() {
|
|
20
|
+
return { greeting: 'Hello, world!' };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
## Here we can define any tables in our database. This example shows how we define a type as a table using
|
|
2
|
+
## the type name as the table name and specifying it is an "export" available in the REST and other external protocols.
|
|
3
|
+
type TableName @table @export {
|
|
4
|
+
id: ID @primaryKey # Here we define primary key (must be one)
|
|
5
|
+
name: String # we can define any other attributes here
|
|
6
|
+
tag: String @indexed # we can specify any attributes that should be indexed
|
|
7
|
+
}
|