adaptic-backend 1.0.35 → 1.0.36
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 +3 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -68,13 +68,6 @@ All the dynamically generated functions for each content model are available und
|
|
|
68
68
|
```typescript
|
|
69
69
|
// client-side/index.ts
|
|
70
70
|
import adaptic, { types, enums } from 'adaptic-backend';
|
|
71
|
-
import { ApolloClient, InMemoryCache } from '@apollo/client';
|
|
72
|
-
|
|
73
|
-
// Initialize Apollo Client
|
|
74
|
-
const client = new ApolloClient({
|
|
75
|
-
uri: 'http://localhost:4000/graphql',
|
|
76
|
-
cache: new InMemoryCache(),
|
|
77
|
-
});
|
|
78
71
|
|
|
79
72
|
export const main = async () => {
|
|
80
73
|
// Example: Create a new User
|
|
@@ -87,7 +80,7 @@ const userProps = {
|
|
|
87
80
|
|
|
88
81
|
|
|
89
82
|
try {
|
|
90
|
-
const createdUser = await adaptic.User.create(userProps
|
|
83
|
+
const createdUser = await adaptic.User.create(userProps) as types.User;
|
|
91
84
|
console.log('Created User:', createdUser);
|
|
92
85
|
} catch (error) {
|
|
93
86
|
console.error('Error creating user:', error);
|
|
@@ -101,7 +94,7 @@ const updateUser = async () => {
|
|
|
101
94
|
};
|
|
102
95
|
|
|
103
96
|
try {
|
|
104
|
-
const updatedUser = await adaptic.User.update(updateProps
|
|
97
|
+
const updatedUser = await adaptic.User.update(updateProps) as types.User;
|
|
105
98
|
console.log('Updated User:', updatedUser);
|
|
106
99
|
} catch (error) {
|
|
107
100
|
console.error('Error updating user:', error);
|
|
@@ -123,18 +116,6 @@ The only difference between client-side and server-side usage is the import stat
|
|
|
123
116
|
```javascript
|
|
124
117
|
// server-side/lambdaFunction.mjs
|
|
125
118
|
import adaptic from 'adaptic-backend/server';
|
|
126
|
-
import pkg from '@apollo/client';
|
|
127
|
-
import fetch from 'cross-fetch';
|
|
128
|
-
|
|
129
|
-
const { ApolloClient, InMemoryCache, HttpLink } = pkg;
|
|
130
|
-
|
|
131
|
-
const client = new ApolloClient({
|
|
132
|
-
link: new HttpLink({
|
|
133
|
-
uri: process.env.GRAPHQL_ENDPOINT,
|
|
134
|
-
fetch,
|
|
135
|
-
}),
|
|
136
|
-
cache: new InMemoryCache(),
|
|
137
|
-
});
|
|
138
119
|
|
|
139
120
|
export const handler = async (event) => {
|
|
140
121
|
// Parse the incoming event data
|
|
@@ -158,7 +139,7 @@ export const handler = async (event) => {
|
|
|
158
139
|
};
|
|
159
140
|
|
|
160
141
|
try {
|
|
161
|
-
const result = await adaptic.dependency.create(dependencyObject
|
|
142
|
+
const result = await adaptic.dependency.create(dependencyObject);
|
|
162
143
|
|
|
163
144
|
return {
|
|
164
145
|
statusCode: 200,
|
package/package.json
CHANGED