@cocreate/server 1.0.0

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 ADDED
@@ -0,0 +1,91 @@
1
+ # CoCreate-server
2
+
3
+ A convenient chain handler allows user to chain multiple CoCreate components together. When one action is complete next one will start. The sequence goes untill all server completed. Grounded on Vanilla javascript, easily configured using HTML5 attributes and/or JavaScript API. Take it for a spin in our [playground!](https://cocreate.app/docs/server)
4
+
5
+ ![minified](https://img.badgesize.io/https://cdn.cocreate.app/server/latest/CoCreate-server.min.js?style=flat-square&label=minified&color=orange)
6
+ ![gzip](https://img.badgesize.io/https://cdn.cocreate.app/server/latest/CoCreate-server.min.js?compression=gzip&style=flat-square&label=gzip&color=yellow)
7
+ ![brotli](https://img.badgesize.io/https://cdn.cocreate.app/server/latest/CoCreate-server.min.js?compression=brotli&style=flat-square&label=brotli)
8
+ ![GitHub latest release](https://img.shields.io/github/v/release/CoCreate-app/CoCreate-action?style=flat-square)
9
+ ![License](https://img.shields.io/github/license/CoCreate-app/CoCreate-action?style=flat-square)
10
+ ![Hiring](https://img.shields.io/static/v1?style=flat-square&label=&message=Hiring&color=blueviolet)
11
+
12
+ ![CoCreate-server](https://cdn.cocreate.app/docs/CoCreate-server.gif)
13
+
14
+ ## [Docs & Demo](https://cocreate.app/docs/server)
15
+
16
+ For a complete guide and working demo refer to the [doumentation](https://cocreate.app/docs/server)
17
+
18
+ ## CDN
19
+
20
+ ```html
21
+ <script src="https://cdn.cocreate.app/server/latest/CoCreate-server.min.js"></script>
22
+ ```
23
+
24
+ ```html
25
+ <script src="https://cdn.cocreate.app/server/latest/CoCreate-server.min.css"></script>
26
+ ```
27
+
28
+ ## NPM
29
+
30
+ ```shell
31
+ $ npm i @cocreate/server
32
+ ```
33
+
34
+ ## yarn
35
+
36
+ ```shell
37
+ $ yarn install @cocreate/server
38
+ ```
39
+
40
+ # Table of Contents
41
+
42
+ - [Table of Contents](#table-of-contents)
43
+ - [Announcements](#announcements)
44
+ - [Roadmap](#roadmap)
45
+ - [How to Contribute](#how-to-contribute)
46
+ - [About](#about)
47
+ - [License](#license)
48
+
49
+ <a name="announcements"></a>
50
+
51
+ # Announcements
52
+
53
+ All updates to this library are documented in our [CHANGELOG](https://github.com/CoCreate-app/CoCreate-server/blob/master/CHANGELOG.md) and [releases](https://github.com/CoCreate-app/CoCreate-server/releases). You may also subscribe to email for releases and breaking changes.
54
+
55
+ <a name="roadmap"></a>
56
+
57
+ # Roadmap
58
+
59
+ If you are interested in the future direction of this project, please take a look at our open [issues](https://github.com/CoCreate-app/CoCreate-server/issues) and [pull requests](https://github.com/CoCreate-app/CoCreate-server/pulls). We would love to hear your feedback.
60
+
61
+ <a name="about"></a>
62
+
63
+ # About
64
+
65
+ CoCreate-server is guided and supported by the CoCreate Developer Experience Team.
66
+
67
+ Please Email the Developer Experience Team [here](mailto:develop@cocreate.app) in case of any queries.
68
+
69
+ CoCreate-server is maintained and funded by CoCreate. The names and logos for CoCreate are trademarks of CoCreate, LLC.
70
+
71
+ <a name="contribute"></a>
72
+
73
+ # How to Contribute
74
+
75
+ We encourage contribution to our libraries (you might even score some nifty swag), please see our [CONTRIBUTING](https://github.com/CoCreate-app/CoCreate-server/blob/master/CONTRIBUTING.md) guide for details.
76
+
77
+ We want this library to be community-driven, and CoCreate led. We need your help to realize this goal. To help make sure we are building the right things in the right order, we ask that you create [issues](https://github.com/CoCreate-app/CoCreate-server/issues) and [pull requests](https://github.com/CoCreate-app/CoCreate-server/pulls) or merely upvote or comment on existing issues or pull requests.
78
+
79
+ We appreciate your continued support, thank you!
80
+
81
+ <a name="license"></a>
82
+
83
+ # License
84
+
85
+ This software is dual-licensed under the GNU Affero General Public License version 3 (AGPLv3) and a commercial license.
86
+
87
+ - **Open Source Use**: For open-source projects and non-commercial use, this software is available under the AGPLv3. The AGPLv3 allows you to freely use, modify, and distribute this software, provided that all modifications and derivative works are also licensed under the AGPLv3. For the full license text, see the [LICENSE file](https://github.com/CoCreate-app/CoCreate-socket-client/blob/master/LICENSE).
88
+
89
+ - **Commercial Use**: For-profit companies and individuals intending to use this software for commercial purposes must obtain a commercial license. The commercial license is available when you sign up for an API key on our [website](https://cocreate.app). This license permits proprietary use and modification of the software without the copyleft requirements of the AGPLv3. It is ideal for integrating this software into proprietary commercial products and applications.
90
+
91
+ If you have not purchased a commercial license and intend to use this software for commercial purposes, you are required to sign up for an API key on our website.
@@ -0,0 +1,38 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>Server | CoCreateJS</title>
5
+
6
+ <!-- CoCreate Favicon -->
7
+ <link
8
+ rel="icon"
9
+ type="image/png"
10
+ sizes="32x32"
11
+ href="../assets/favicon.ico" />
12
+ </head>
13
+ <body>
14
+ <form>
15
+ <textarea server="message"></textarea>
16
+ <button actions="Server, reset">click</button>
17
+ </form>
18
+
19
+ <!-- <div
20
+ array="users"
21
+ array="interviews"
22
+ object
23
+ filter-sort-key="name"
24
+ filter-sort-direction="asc"
25
+ render-selector="[template]">
26
+ <div
27
+ class="background:gainsboro:hover border-bottom:1px_solid_darkgray"
28
+ template
29
+ object="{{object._id}}"
30
+ toggle="selected">
31
+ <p>{{Server}}</p>
32
+ </div>
33
+ </div> -->
34
+
35
+ <!-- <script src="../src/CoCreate-server.js"></script> -->
36
+ <script src="./dist/CoCreate.js"></script>
37
+ </body>
38
+ </html>
@@ -0,0 +1,380 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <title>CoCreate-server Documentation | CoCreateJS</title>
8
+ <link
9
+ rel="icon"
10
+ type="image/png"
11
+ sizes="32x32"
12
+ href="https://cocreate.app/images/favicon.ico" />
13
+ <meta
14
+ name="description"
15
+ content="A convenient chain handler allows user to chain multiple components together. When one server is complete next one will start untill all server completed." />
16
+ <meta
17
+ name="keywords"
18
+ content="helper classes, utility classes, css framework, css library, inline style classes" />
19
+ <meta name="robots" content="index,follow" />
20
+ <meta
21
+ property="og:image"
22
+ content="https://cdn.cocreate.app/docs/server.png" />
23
+
24
+ <!-- CoCreate CSS -->
25
+ <link
26
+ rel="stylesheet"
27
+ href="https://cdn.cocreate.app/latest/CoCreate.min.css"
28
+ type="text/css" />
29
+ <link
30
+ rel="stylesheet"
31
+ href="../index.css"
32
+ array="files"
33
+ object="60888216117c640e7596303f"
34
+ key="src"
35
+ type="text/css"
36
+ save="true" />
37
+ <link rel="manifest" href="/manifest.webmanifest" />
38
+ </head>
39
+
40
+ <body>
41
+ <!-- Navbar -->
42
+ <nav
43
+ class="width:100% display:flex align-items:center background:transparent padding-top:10px padding-bottom:10px"
44
+ content_id="content"
45
+ scroll="sticky-nav,"
46
+ scroll-up="5"
47
+ scroll-down="5"
48
+ path="../"
49
+ src="../components/navbar.html"></nav>
50
+ <sidenav
51
+ id="menuL"
52
+ class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl"
53
+ resizable
54
+ resize-selector="[content_id='content']"
55
+ resize-property="margin-left"
56
+ resize-value="width">
57
+ <menu
58
+ array="files"
59
+ object="603717b07de7fb350ae9fec8"
60
+ key="src"></menu>
61
+ <div resize="right"></div>
62
+ </sidenav>
63
+ <main
64
+ class="padding-top:15px padding:15px@lg@xl"
65
+ content_id="content"
66
+ id="cocreate-server">
67
+ <div
68
+ class="display:flex flex-wrap:wrap justify-content:space-between position:relative margin:10px">
69
+ <div class="display:flex align-items:center">
70
+ <h2>CoCreate-server</h2>
71
+ </div>
72
+ <div
73
+ class="display:flex align-items:center font-size:20px position:absolute right:0 padding:5px background:white">
74
+ <div
75
+ class="display:flex align-items:center transition:0.3s padding-left:10px"
76
+ share-network="true"
77
+ share-text="A convenient chain handler allows user to chain multiple components together. When one server is complete next one will start untill all server completed."
78
+ share-title="CoCreate server"
79
+ share-height="600"
80
+ share-width="700"
81
+ share-media="https://cdn.cocreate.app/docs/server.png"
82
+ hover="display:block!important"
83
+ hover-selector=".social-networks">
84
+ <div class="display:none social-networks">
85
+ <a
86
+ class="margin-right:15px"
87
+ share-network="twitter"
88
+ title="Share on twitter"
89
+ ><i
90
+ class="height:20px fill:#505050"
91
+ src="/assets/svg/twitter.svg"></i
92
+ ></a>
93
+ <a
94
+ class="margin-right:15px"
95
+ share-network="facebook"
96
+ title="Share on Facebook"
97
+ ><i
98
+ class="height:20px fill:#505050"
99
+ src="/assets/svg/facebook.svg"></i
100
+ ></a>
101
+ <a
102
+ class="margin-right:15px"
103
+ share-network="instagram"
104
+ title="Share on instagram"
105
+ ><i
106
+ class="height:20px fill:#505050"
107
+ src="/assets/svg/instagram.svg"></i
108
+ ></a>
109
+ </div>
110
+ <a
111
+ class="margin-right:15px"
112
+ share-network="share"
113
+ title="Share on share"
114
+ ><i
115
+ class="height:20px fill:#505050"
116
+ src="/assets/svg/share-alt.svg"></i
117
+ ></a>
118
+ </div>
119
+ <a
120
+ class="margin-right:15px"
121
+ share-network="share"
122
+ title="Share on share"
123
+ ><i
124
+ class="height:20px fill:#505050"
125
+ src="/assets/svg/share-alt.svg"></i
126
+ ></a>
127
+ </div>
128
+ <a
129
+ href="https://github.com/CoCreate-app/CoCreate-server"
130
+ target="_blank"
131
+ class=""
132
+ ><i
133
+ class="height:20px fill:#505050"
134
+ src="/assets/svg/github.svg"></i
135
+ ></a>
136
+ </div>
137
+
138
+ <h1
139
+ class="max-width:500px margin:20px_10px line-height:1.5 font-size:16px font-weight:100">
140
+ A convenient chain handler allows user to chain multiple
141
+ CoCreate components together. When one server is complete next
142
+ one will start. The sequence goes untill all server completed.
143
+ Grounded on Vanilla javascript, easily configured using HTML5
144
+ attributes and/or JavaScript API.
145
+ </h1>
146
+ <div id="server-section" class="display:flex flex-wrap:wrap">
147
+ <div
148
+ class="flex-grow:1 width:400px width:300px@xs padding:0px_10px margin-top:60px">
149
+ <div
150
+ id="server-install"
151
+ class="border-bottom:1px_solid_lightgrey"
152
+ scroll
153
+ scroll-intersect="color:dodgerblue"
154
+ scroll-selector="#server-install-section">
155
+ <span
156
+ class="display:flex align-items:center width:fit-content"
157
+ hover="display:block!important"
158
+ hover-selector="[href='#server-install']">
159
+ <h2 class="padding:5px_0px">Install</h2>
160
+ <a
161
+ class="margin-left:10px display:none"
162
+ href="#server-install"
163
+ ><i
164
+ class="height:20px fill:#505050"
165
+ src="/assets/svg/link.svg"></i
166
+ ></a>
167
+ </span>
168
+ </div>
169
+
170
+ <pre><code class="language-bash">npm i @cocreate/server</code></pre>
171
+ <p class="padding:10px_0px line-height:1.5">
172
+ Or you can use cdn link:
173
+ </p>
174
+ <pre><code class="language-html">&lt;script&gt;https://cdn.cocreate.app/server/latest/CoCreate-server.min.js&lt;/script&gt;</code></pre>
175
+
176
+ <div
177
+ id="server-usage"
178
+ class="margin-top:80px border-bottom:1px_solid_lightgrey"
179
+ scroll
180
+ scroll-intersect="color:dodgerblue"
181
+ scroll-selector="#server-usage-section">
182
+ <span
183
+ class="display:flex align-items:center width:fit-content"
184
+ hover="display:block!important"
185
+ hover-selector="[href='#server-usage']">
186
+ <h2 class="padding:5px_0px">Usage</h2>
187
+ <a
188
+ class="margin-left:10px display:none"
189
+ href="#server-usage"
190
+ ><i
191
+ class="height:20px fill:#505050"
192
+ src="/assets/svg/link.svg"></i
193
+ ></a>
194
+ </span>
195
+ </div>
196
+ <div class="">
197
+ <p class="padding:10px_0px line-height:1.5">
198
+ This is server usage
199
+ </p>
200
+
201
+ <div class="flex-grow:1 min-width:300px width:100%">
202
+ <pre><code class="language-html">&lt;div&gt;&lt;/div&gt;</code></pre>
203
+ </div>
204
+ <p class="padding:10px_0px line-height:1.5">
205
+ This is server usage
206
+ </p>
207
+ <p class="padding:10px_0px line-height:1.5">
208
+ This is server usage
209
+ </p>
210
+ </div>
211
+
212
+ <div
213
+ id="server-attributes"
214
+ class="margin-top:80px border-bottom:1px_solid_lightgrey"
215
+ scroll
216
+ scroll-intersect="color:dodgerblue"
217
+ scroll-selector="#server-attributes-section">
218
+ <span
219
+ class="display:flex align-items:center width:fit-content"
220
+ hover="display:block!important"
221
+ hover-selector="[href='#server-attributes']">
222
+ <h2 class="padding:5px_0px">Attributes</h2>
223
+ <a
224
+ class="margin-left:10px display:none"
225
+ href="#server-attributes"
226
+ ><i
227
+ class="height:20px fill:#505050"
228
+ src="/assets/svg/link.svg"></i
229
+ ></a>
230
+ </span>
231
+ </div>
232
+
233
+ <ul class="list-style-type:none">
234
+ <li
235
+ class="padding:15px_0px border-bottom:1px_solid_lightgrey">
236
+ <h4>
237
+ <span>server</span>
238
+ <span class="cocreate-badge success"
239
+ >string</span
240
+ >
241
+ <span class="cocreate-badge warning"
242
+ >optional</span
243
+ >
244
+ </h4>
245
+ <p>server-attribute</p>
246
+ </li>
247
+ <li
248
+ class="padding:15px_0px border-bottom:1px_solid_lightgrey">
249
+ <h4>
250
+ <span>server</span>
251
+ <span class="cocreate-badge success"
252
+ >string</span
253
+ >
254
+ <span class="cocreate-badge warning"
255
+ >optional</span
256
+ >
257
+ </h4>
258
+ <p>server-attribute</p>
259
+ </li>
260
+ </ul>
261
+ </div>
262
+
263
+ <div
264
+ class="flex-grow:1 width:300px padding:0px_10px margin-top:60px border-bottom:1px_solid_lightgrey">
265
+ <!-- SandBox -->
266
+ <div
267
+ id="server-demo"
268
+ class="border-bottom:1px_solid_lightgrey"
269
+ scroll
270
+ scroll-intersect="color:dodgerblue"
271
+ scroll-selector="#server-demo-section">
272
+ <span
273
+ class="display:flex align-items:center width:fit-content"
274
+ hover="display:block!important"
275
+ hover-selector="[href='#server-demo']">
276
+ <h2 class="padding:5px_0px">Demo</h2>
277
+ <a
278
+ class="margin-left:10px display:none"
279
+ href="#server-demo"
280
+ ><i
281
+ class="height:20px fill:#505050"
282
+ src="/assets/svg/link.svg"></i
283
+ ></a>
284
+ </span>
285
+ </div>
286
+
287
+ <div
288
+ class="position:sticky top:0 padding:15px_0px height:100vh">
289
+ <!-- SandBox -->
290
+ <div
291
+ class="display:flex flex-direction:column position:relative overflow:hidden card border-radius:2px width:auto height:600px margin-top:20px"
292
+ id="playground">
293
+ <div
294
+ id="demo-code"
295
+ resizable
296
+ class="position:relative height:50%">
297
+ <textarea
298
+ type="code"
299
+ lang="html"
300
+ array="demos"
301
+ object=""
302
+ key="demo"
303
+ save="false"
304
+ id="demo"
305
+ class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
306
+ <div
307
+ resize="bottom"
308
+ class="background:lightgrey"></div>
309
+ </div>
310
+
311
+ <div
312
+ id="demo-preview"
313
+ class="position:relative overflow:auto background-color:white">
314
+ <div class="demopreview padding:20px"></div>
315
+ </div>
316
+
317
+ <div
318
+ class="font-size:20px position:absolute top:10px right:10px opacity:0.6">
319
+ <a
320
+ class="margin-right:10px"
321
+ id="eye"
322
+ show="#eye-slash"
323
+ hide="#eye, #demo-preview"
324
+ toggle="code-height"
325
+ toggle-selector="#demo-code"
326
+ ><i
327
+ class="height:18px fill:#505050"
328
+ src="/assets/svg/eye.svg"></i
329
+ ></a>
330
+ <a
331
+ class="margin-right:10px"
332
+ hidden
333
+ id="eye-slash"
334
+ show="#eye, #demo-preview"
335
+ hide="#eye-slash"
336
+ toggle="code-height"
337
+ toggle-selector="#demo-code"
338
+ ><i
339
+ class="height:20px fill:#505050"
340
+ src="/assets/svg/eye-slash.svg"></i
341
+ ></a>
342
+ <a
343
+ class="margin-right:10px"
344
+ id="code"
345
+ show="#code-slash"
346
+ hide="#code, #demo-code"
347
+ ><i
348
+ class="height:20px fill:#505050"
349
+ src="/assets/svg/code.svg"></i
350
+ ></a>
351
+ <a
352
+ class="margin-right:10px"
353
+ hidden
354
+ id="code-slash"
355
+ show="#code, #demo-code"
356
+ hide="#code-slash"
357
+ ><i
358
+ class="display:flex height:18px fill:#505050"
359
+ src="/assets/svg/code.svg"></i
360
+ ></a>
361
+ <a
362
+ class="margin-right:5px"
363
+ fullscreen
364
+ fullscreen-selector="#playground"></a>
365
+ </div>
366
+ </div>
367
+ <!-- End SandBox -->
368
+ </div>
369
+ </div>
370
+ </div>
371
+ <button
372
+ href="https://github.com/CoCreate-app/CoCreate-server/tree/master/docs/index.html?message=docs%3A%20describe%20your%20change..."
373
+ target="_blank"
374
+ class="display:flex justify-content:center align-items:center position:fixed bottom:15px right:15px height:50px width:50px border-radius:50% box-shadow:0px_2px_10px_0px_rgba(0,_0,_0,_0.4)">
375
+ <i class="height:20px" src="../assets/svg/pencil-alt.svg"></i>
376
+ </button>
377
+ </main>
378
+ <script src="https://cdn.cocreate.app/latest/CoCreate.min.js"></script>
379
+ </body>
380
+ </html>
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@cocreate/server",
3
+ "version": "1.0.0",
4
+ "description": "An intergration with Server and CoCreateJS.",
5
+ "keywords": [
6
+ "server",
7
+ "cocreate",
8
+ "low-code-framework",
9
+ "no-code-framework",
10
+ "cocreatejs",
11
+ "cocreatejs-component",
12
+ "cocreate-framework",
13
+ "no-code",
14
+ "low-code",
15
+ "collaborative-framework",
16
+ "realtime",
17
+ "realtime-framework",
18
+ "collaboration",
19
+ "shared-editing",
20
+ "html5-framework",
21
+ "javascript-framework"
22
+ ],
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "scripts": {
27
+ "start": "npx webpack --config webpack.config.js",
28
+ "build": "npx webpack --mode=production --config webpack.config.js",
29
+ "dev": "npx webpack --config webpack.config.js --watch",
30
+ "postinstall": "node -e \"const { execSync } = require('child_process'); try { execSync('coc --version', { stdio: 'ignore' }); } catch (error) { try { execSync('npm install -g @cocreate/cli', { stdio: 'inherit' }); console.log('Installed \"@cocreate/cli\" globally.'); } catch (error) { console.error('Failed to install \"@cocreate/cli\" globally:', error); } }\""
31
+ },
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/CoCreate-app/CoCreate-server.git"
35
+ },
36
+ "author": "CoCreate LLC",
37
+ "license": "AGPL-3.0",
38
+ "bugs": {
39
+ "url": "https://github.com/CoCreate-app/CoCreate-server/issues"
40
+ },
41
+ "homepage": "https://cocreate.app/docs/server",
42
+ "funding": {
43
+ "type": "GitHub Sponsors ❤",
44
+ "url": "https://github.com/sponsors/CoCreate-app"
45
+ },
46
+ "main": "./src/index.js",
47
+ "dependencies": {
48
+ "server-client": "^5.0.0"
49
+ }
50
+ }
@@ -0,0 +1,22 @@
1
+ module.exports = {
2
+ dryRun: false,
3
+ branches: ["master"],
4
+ plugins: [
5
+ "@semantic-release/commit-analyzer",
6
+ "@semantic-release/release-notes-generator",
7
+ [
8
+ "@semantic-release/changelog",
9
+ {
10
+ changelogFile: "CHANGELOG.md",
11
+ },
12
+ ],
13
+ "@semantic-release/npm",
14
+ "@semantic-release/github",
15
+ [
16
+ "@semantic-release/git",
17
+ {
18
+ assets: ["CHANGELOG.md", "package.json"],
19
+ },
20
+ ],
21
+ ],
22
+ };
package/src/index.js ADDED
@@ -0,0 +1,36 @@
1
+ const Https = require('https');
2
+ const Http = require('http');
3
+ const fs = require('fs');
4
+ const tls = require('tls');
5
+
6
+ // Load certificates or handle them dynamically via SNI
7
+ function loadCertificates(domain) {
8
+ try {
9
+ return {
10
+ key: fs.readFileSync(`certificates/${domain}/private.key`),
11
+ cert: fs.readFileSync(`certificates/${domain}/certificate.crt`),
12
+ };
13
+ } catch (error) {
14
+ console.error("Error loading certificates for domain:", domain);
15
+ throw error; // Or handle it by returning default certificates
16
+ }
17
+ }
18
+
19
+ function sniCallback(domain, cb) {
20
+ try {
21
+ const sslContext = tls.createSecureContext(loadCertificates(domain));
22
+ cb(null, sslContext);
23
+ } catch (error) {
24
+ console.error("Error in SNI callback for domain:", domain, error);
25
+ cb(error); // handle error or use default context
26
+ }
27
+ }
28
+
29
+ // Create HTTPS server
30
+ const https = Https.createServer({ SNICallback: sniCallback });
31
+
32
+ // Create HTTP server
33
+ const http = Http.createServer();
34
+
35
+ module.exports = { https, http };
36
+