Skip to content

Commit a2a5c47

Browse files
committed
Import code from previous version
1 parent dd8233f commit a2a5c47

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+7737
-588
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
22

33
# dependencies
4-
/node_modules
4+
node_modules/
55
/.pnp
66
.pnp.js
77
.yarn/install-state.gz

README.md

+18-8
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,38 @@
66
77
A [`Thing`](https://schema.org/Thing) metamodel with admin interface.
88

9-
The GraphDL (Graph Descriptor Language) framework describes and manipulates data within an Object-Role Model (ORM) graph structure. This framework provides a structured way to represent and interact with complex data relationships. The core components and concepts of GraphDL include:
9+
The GraphDL (Graph Descriptor Language) application framework provides a comprehensive Object-Role Model (ORM) framework for modeling relationships and processes, making it particularly suitable for developers, business analysts, and AIs creating e-commerce platforms, content management systems, and more. By describing the requirements for an application, then translating the description into simple sentences and abstracting out atomic fact types, the atomic fact types can be added to the GraphDL application as `Graph Schema` objects, which form a knowledge graph that can be relational-mapped into a database that stores `Graph`s in third normal form. The core components and concepts of GraphDL include:
1010

11-
**Nouns and Resources:** Represent entities, objects, or values within the system. Nouns can be any subject or direct object of a sentence. They serve as the primary nodes within a Graph Schema, embodying the entities around which relationships are formed. When a Graph Schema is implemented as a Graph, Nouns are stored as Resource nodes in the Graph. A Resource represents a single instance of a Noun, such as a user, product, order, etc.
11+
**Graph Schemas and Graphs** `Graph Schema`s act as blueprints for how data is structured within a `Graph`. They define the `Reading`s of `Noun`s and `Verb`s.
1212

13-
**Verbs, Readings, and Roles:** Define the interactions between nouns. In a graph context, Readings with Roles can be thought of as the edges that connect nodes (Nouns), specifying the type of interaction or relationship that exists between them. This could include actions like "create", "modify", "owns", "relates to", etc. Readings provide the main interface for providing API definitions with verbs. Roles are used to define the directionality of the relationships between all nouns. When a Reading is accessed by an API, the Verb and Resources are stored as a Graph that implements that Reading's Graph Schema.
13+
**Readings and Roles:** Define the interactions between `Noun`s. `Reading`s with `Role`s can be thought of as the edges that connect nodes (`Noun`s), specifying the type of interaction or relationship that exists between them. `Reading`s provide the main interface for providing API definitions. When a `Reading` is accessed by an API, the `Verb`'s `Action` and the `Noun`s' `Resource`s are stored as a `Graph` that implements that `Reading`'s `Graph Schema`. `Role`s are used to define the part that each `Noun` plays in the `Graph Schema`. The number of `Role`s in a `Graph Schema` determines its arity. `Graph Schema`s can be unary, representing a checkbox or boolean field, binary, representing a value/field or relationship with another entity, or any arity higher than binary to represent a complex fact or table.
1414

15-
**Graph Schemas, Contraints, and Graphs:** Graph Schemas act as blueprints for how data is structured within a Graph. They define the readings of nouns and verbs that exist and how they are allowed to interact. Constraints ensure data consistency and govern the rules for how entities map to a relational database schema.
15+
**Nouns and Resources:** Represent entities, objects, or values within the system. `Noun`s can be any subject or direct object of a sentence. They serve as the primary nodes within a `Graph Schema`, embodying the entities around which relationships are formed. When a `Graph Schema` is implemented as a `Graph`, `Noun`s are stored as `Resource` nodes in the `Graph`. A `Resource` represents a single instance of a `Noun`, such as a user, product, order, etc.
1616

17-
**Statuses and Transitions:** Statuses represent the status of an entity at a given time, and transitions define how entities move from one state to another based on certain verbs or events. This is crucial for modeling workflows and processes within a system.
17+
**Verbs and Actions** A `Verb` represents the relationship between two `Noun`s. It defines the type of interaction or relationship that exists between them. An `Action` is a specific instance of a `Verb` that is used in a `Graph`. This could include actions like "create", "modify", "owns", "relates to", etc.
1818

19-
**Events, Actions, and Guards:** These components detail the dynamics within the graph. Events trigger transitions between statuses, Actions are instances of Verbs that are used in a Graph, and Guards define rules or conditions that must be met for certain actions to take place or for transitions between states to occur.
19+
**Statuses and Transitions:** `Status`es represent the status of an entity at a given time, and `Transition`s define how entities move from one state to another based on certain `Event`s. This is useful for modeling state machines, workflows, and processes within a system.
2020

21-
GraphDL provides a comprehensive framework for modeling relationships and processes within a system, making it particularly suitable for applications that deal with complex data structures, such as e-commerce platforms, content management systems, and more. This framework allows developers, business analysts, and AIs to represent, query, and manipulate data in a way that mirrors real-world interactions and relationships.
21+
**Events and Guards:** These components detail the dynamics within a state machine. `Event`s trigger `Transition`s between `Status`es, and `Guard`s define conditions that must be met for `Transition`s between `Status`es to occur.
2222

23-
This repo was created by running `npx create-payload-app@latest` and selecting the "blank" template.
23+
**Constraints and Constraint Spans:** Uniqueness `Constraint`s govern how entities map to a relational database schema. They span over `Role`s using `Constraint Span`s to specify the multiplicity. The `roleRelationship` field on a Graph Schema defines and interprets the `Constraint Span`s and the `Constraint`s by this pattern: One-to-many (1:\*) uniqueness `Constraint`s are part of a `Constraint Span` over only the first entity, many-to-one (\*:1) over only the last entity, many-to-many (\*:\*) over both roles, and one-to-one (1:1) is represented by two `Constraint Span`s, one for each of the roles in the graph schema.
24+
25+
## Generation
26+
27+
The data types from the fields in the database determine the UI, making it possible to generate software. UI may also be customized per entity or table. Relational database schemas and UIs can be generated using the `Generator` object.
28+
29+
## Visualizations
30+
31+
ORM2 and UML diagrams of GraphDL are included:
2432

2533
![Relational Model](design/Schema.png)
2634

2735
![Graph](design/Core.png)
2836

2937
Open ORM model using Visual Studio 2022 with [NORMA](https://marketplace.visualstudio.com/items?itemName=ORMSolutions.NORMA2022) or explore online using <https://ormsolutions.com/tools/orm.aspx>
3038

39+
This repo was created by running `npx create-payload-app@latest` and selecting the "blank" template.
40+
3141
## Development
3242

3343
To spin up the project locally, follow these steps:
File renamed without changes.
File renamed without changes.
File renamed without changes.

fly.toml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# fly.toml app configuration file generated for graphdl on 2024-03-23T02:29:29-05:00
2+
#
3+
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
4+
#
5+
6+
app = 'graphdl'
7+
primary_region = 'ord'
8+
9+
[build]
10+
11+
[http_service]
12+
internal_port = 3000
13+
force_https = true
14+
auto_stop_machines = true
15+
auto_start_machines = true
16+
min_machines_running = 1
17+
processes = ['app']
18+
19+
[[vm]]
20+
memory = '1gb'
21+
cpu_kind = 'shared'
22+
cpus = 1

package.json

+16-13
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,33 @@
1212
"generate:types": "cross-env NODE_OPTIONS=--no-deprecation payload generate:types",
1313
"lint": "cross-env NODE_OPTIONS=--no-deprecation next lint",
1414
"payload": "cross-env NODE_OPTIONS=--no-deprecation payload",
15-
"start": "cross-env NODE_OPTIONS=--no-deprecation next start"
15+
"start": "cross-env NODE_OPTIONS=--no-deprecation next start",
16+
"publish": "fly deploy"
1617
},
1718
"dependencies": {
18-
"@payloadcms/db-mongodb": "3.9.0",
19-
"@payloadcms/next": "3.9.0",
20-
"@payloadcms/payload-cloud": "3.9.0",
21-
"@payloadcms/richtext-lexical": "3.9.0",
19+
"@payloadcms/db-mongodb": "3.12.0",
20+
"@payloadcms/next": "3.12.0",
21+
"@payloadcms/payload-cloud": "3.12.0",
22+
"@payloadcms/richtext-lexical": "3.12.0",
23+
"@payloadcms/richtext-slate": "^3.12.0",
2224
"cross-env": "^7.0.3",
2325
"graphql": "^16.8.1",
24-
"next": "15.1.0",
25-
"payload": "3.9.0",
26+
"json-schema-library": "^10.0.0-rc6",
27+
"next": "15.1.3",
28+
"payload": "3.12.0",
2629
"react": "19.0.0",
2730
"react-dom": "19.0.0",
28-
"sharp": "0.32.6"
31+
"sharp": "0.33.5"
2932
},
3033
"devDependencies": {
3134
"@eslint/eslintrc": "^3.2.0",
32-
"@types/node": "^22.5.4",
33-
"@types/react": "19.0.1",
34-
"@types/react-dom": "19.0.1",
35+
"@types/node": "^22.10.3",
36+
"@types/react": "19.0.2",
37+
"@types/react-dom": "19.0.2",
3538
"eslint": "^9.16.0",
36-
"eslint-config-next": "15.1.0",
39+
"eslint-config-next": "15.1.3",
3740
"prettier": "^3.4.2",
38-
"typescript": "5.7.2"
41+
"typescript": "^5.7.2"
3942
},
4043
"engines": {
4144
"node": "^18.20.2 || >=20.9.0"

sdk/README.md

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# GraphDL SDK
2+
3+
The GraphDL SDK is a TypeScript library that provides a simple and convenient way to interact with the GraphDL API. It is built on top of the `payload-rest-client` library and uses environment variables for configuration.
4+
5+
## Installation
6+
7+
```bash
8+
npm install --save graphdl-sdk
9+
```
10+
11+
or yarn:
12+
13+
```bash
14+
yarn add graphdl-sdk
15+
```
16+
17+
## Usage
18+
19+
First, import the SDK into your project:
20+
21+
```typescript
22+
import { SDK } from 'graphdl-sdk'
23+
```
24+
25+
Then, initialize the SDK with your API key:
26+
27+
```typescript
28+
const sdk = SDK('your-api-key')
29+
```
30+
31+
If you don't provide an API key, the SDK will try to use the `GRAPHDL_API_KEY` environment variable.
32+
33+
## API
34+
35+
The SDK provides access to various collections in the GraphDL API:
36+
37+
- `sdk.things`
38+
- `sdk.nouns`
39+
- `sdk.resources`
40+
- `sdk.verbs`
41+
- `sdk.actions`
42+
- `sdk.constraints`
43+
- `sdk.roles`
44+
- `sdk.graphSchemas`
45+
- `sdk.graphs`
46+
- `sdk.eventTypes`
47+
- `sdk.events`
48+
- `sdk.data`
49+
- `sdk.streams`
50+
- `sdk.states`
51+
- `sdk.stateMachineDefinitions`
52+
- `sdk.stateMachines`
53+
- `sdk.transitions`
54+
- `sdk.guardExpressionRunTypes`
55+
- `sdk.guardExpressionRuns`
56+
57+
Each of these collections corresponds to a specific part of the GraphDL API and can be used to perform CRUD operations.
58+
59+
## Environment Variables
60+
61+
The SDK uses the following environment variables:
62+
63+
- `GRAPHDL_API_KEY`: Your GraphDL API key.
64+
65+
## Contributing
66+
67+
Contributions are welcome! Please read our contributing guidelines before getting started.
68+
69+
## License
70+
71+
This project is licensed under the terms of the MIT license.

sdk/dist/index.d.ts

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { Config } from './payload-types';
2+
import * as gdl from './payload-types';
3+
export declare function SDK(apiKey?: string): {
4+
api: import("payload-rest-client/dist/types").RPC<Config, "en">;
5+
things: import("payload-rest-client/dist/types").CollectionsApi<gdl.Thing, "en">;
6+
nouns: import("payload-rest-client/dist/types").CollectionsApi<gdl.Noun, "en">;
7+
resources: import("payload-rest-client/dist/types").CollectionsApi<gdl.Resource, "en">;
8+
verbs: import("payload-rest-client/dist/types").CollectionsApi<gdl.Verb, "en">;
9+
actions: import("payload-rest-client/dist/types").CollectionsApi<gdl.Action, "en">;
10+
constraints: import("payload-rest-client/dist/types").CollectionsApi<gdl.Constraint, "en">;
11+
roles: import("payload-rest-client/dist/types").CollectionsApi<gdl.Role, "en">;
12+
graphSchemas: import("payload-rest-client/dist/types").CollectionsApi<gdl.GraphSchema, "en">;
13+
graphs: import("payload-rest-client/dist/types").CollectionsApi<gdl.Graph, "en">;
14+
eventTypes: import("payload-rest-client/dist/types").CollectionsApi<gdl.EventType, "en">;
15+
events: import("payload-rest-client/dist/types").CollectionsApi<gdl.Event, "en">;
16+
data: import("payload-rest-client/dist/types").CollectionsApi<gdl.Datum, "en">;
17+
streams: import("payload-rest-client/dist/types").CollectionsApi<gdl.Stream, "en">;
18+
states: import("payload-rest-client/dist/types").CollectionsApi<gdl.Status, "en">;
19+
stateMachineDefinitions: import("payload-rest-client/dist/types").CollectionsApi<gdl.StateMachineDefinition, "en">;
20+
stateMachines: import("payload-rest-client/dist/types").CollectionsApi<gdl.StateMachine, "en">;
21+
transitions: import("payload-rest-client/dist/types").CollectionsApi<gdl.Transition, "en">;
22+
guardExpressionRunTypes: import("payload-rest-client/dist/types").CollectionsApi<gdl.GuardExpression, "en">;
23+
guardExpressionRuns: import("payload-rest-client/dist/types").CollectionsApi<gdl.GuardExpressionRun, "en">;
24+
relationalMap: (schemas: gdl.GraphSchema[]) => Promise<Record<string, {
25+
name: string;
26+
columns: gdl.Role[];
27+
}>>;
28+
} | null;
29+
export * from './payload-types';
30+
//# sourceMappingURL=index.d.ts.map

sdk/dist/index.d.ts.map

+1
Original file line numberDiff line numberDiff line change

0 commit comments

Comments
 (0)