@cocreate/unique 1.20.4 → 1.21.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.
@@ -1,8 +1,10 @@
1
1
  name: Automated Workflow
2
+
2
3
  on:
3
4
  push:
4
5
  branches:
5
6
  - master
7
+
6
8
  jobs:
7
9
  about:
8
10
  runs-on: ubuntu-latest
@@ -18,27 +20,37 @@ jobs:
18
20
  with:
19
21
  direction: overwrite-github
20
22
  githubToken: "${{ secrets.GITHUB }}"
23
+
21
24
  release:
22
25
  runs-on: ubuntu-latest
23
26
  steps:
24
27
  - name: Checkout
25
- uses: actions/checkout@v3
26
- - name: Setup Node.js
27
- uses: actions/setup-node@v3
28
+ uses: actions/checkout@v4
28
29
  with:
29
- node-version: 14
30
- - name: Semantic Release
31
- uses: cycjimmy/semantic-release-action@v3
32
- id: semantic
30
+ fetch-depth: 0 # Required so semantic-release can trace git tags/history
31
+
32
+ - name: Setup Node.js
33
+ uses: actions/setup-node@v4
33
34
  with:
34
- extra_plugins: |
35
- @semantic-release/changelog
35
+ node-version: 22
36
+
37
+ - name: Install Semantic Release & Plugins
38
+ # Installs semantic-release and its plugins on the runner
39
+ run: |
40
+ npm install -g semantic-release \
41
+ @semantic-release/changelog \
42
+ @semantic-release/npm \
43
+ @semantic-release/github \
36
44
  @semantic-release/git
37
- @semantic-release/github
45
+
46
+ - name: Run Semantic Release (Native)
47
+ id: semantic
48
+ # This will automatically pick up your export default config file in the repository root
49
+ run: npx semantic-release
38
50
  env:
39
- GITHUB_TOKEN: "${{ secrets.GITHUB }}"
51
+ GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
40
52
  NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
53
+
41
54
  outputs:
42
55
  new_release_published: "${{ steps.semantic.outputs.new_release_published }}"
43
- new_release_version: "${{ steps.semantic.outputs.new_release_version }}"
44
-
56
+ new_release_version: "${{ steps.semantic.outputs.new_release_version }}"
@@ -14,8 +14,7 @@ jobs:
14
14
  env:
15
15
  DRY_RUN: ${{ github.event.inputs.dry_run }}
16
16
  GITHUB_TOKEN: "${{ secrets.GITHUB }}"
17
- NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
18
-
17
+
19
18
  steps:
20
19
  - name: Checkout
21
20
  uses: actions/checkout@v3
package/CHANGELOG.md CHANGED
@@ -1,3 +1,31 @@
1
+ # [1.21.0](https://github.com/CoCreate-app/CoCreate-unique/compare/v1.20.6...v1.21.0) (2026-07-17)
2
+
3
+
4
+ ### Features
5
+
6
+ * update automated workflow and release configuration for improved semantic release handling ([e861f70](https://github.com/CoCreate-app/CoCreate-unique/commit/e861f7092a927fa49537a94f85d48c6f1ce42575))
7
+
8
+ ## [1.20.6](https://github.com/CoCreate-app/CoCreate-unique/compare/v1.20.5...v1.20.6) (2026-07-14)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * bump package versions ([ebce30c](https://github.com/CoCreate-app/CoCreate-unique/commit/ebce30c6194a85eddf930e4c6ecf5bcc85d5ef31))
14
+ * remove unnecessary console logs in init function for cleaner output ([23771c3](https://github.com/CoCreate-app/CoCreate-unique/commit/23771c30d2f2a9f01a9944ef642ef91fb609ae30))
15
+ * removed post install and add add packages to apprved list ([0b16179](https://github.com/CoCreate-app/CoCreate-unique/commit/0b16179dd085052eb7e35cd7c6888885a412ef21))
16
+ * root factory variable Module ([0ed3efd](https://github.com/CoCreate-app/CoCreate-unique/commit/0ed3efd27941b4a501a639ee89dc1b15d525acd0))
17
+ * root factory variable Module ([39e8232](https://github.com/CoCreate-app/CoCreate-unique/commit/39e82323c9893d4d997359ac0e03b7205c4f4ca6))
18
+ * semantic version handling ([d2cfc28](https://github.com/CoCreate-app/CoCreate-unique/commit/d2cfc2821b986736083fc4d55b859b9cb066cc77))
19
+ * update module export to ES6 syntax in release.config.js ([d72641d](https://github.com/CoCreate-app/CoCreate-unique/commit/d72641d6d1b0ac25b3b6d3ef6810ef09f16e734d))
20
+ * update package.json to use ESM and restructure server/client entry points ([267ff94](https://github.com/CoCreate-app/CoCreate-unique/commit/267ff94df357f12933497c619d1036de225078ca))
21
+
22
+ ## [1.20.5](https://github.com/CoCreate-app/CoCreate-unique/compare/v1.20.4...v1.20.5) (2026-02-04)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * update worklow ([35f755c](https://github.com/CoCreate-app/CoCreate-unique/commit/35f755ce2e3756b8729d172108bcaac91bba599c))
28
+
1
29
  ## [1.20.4](https://github.com/CoCreate-app/CoCreate-unique/compare/v1.20.3...v1.20.4) (2025-05-01)
2
30
 
3
31
 
package/package.json CHANGED
@@ -1,18 +1,10 @@
1
1
  {
2
2
  "name": "@cocreate/unique",
3
- "version": "1.20.4",
3
+ "version": "1.21.0",
4
4
  "description": "A simple unique component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "unique",
7
- "cocreate",
8
- "low-code-framework",
9
- "no-code-framework",
10
- "cocreatejs",
11
- "cocreatejs-component",
12
- "cocreate-framework",
13
- "no-code",
14
7
  "low-code",
15
- "collaborative-framework",
16
8
  "realtime",
17
9
  "realtime-framework",
18
10
  "collaboration",
@@ -26,8 +18,7 @@
26
18
  "scripts": {
27
19
  "start": "npx webpack --config webpack.config.js",
28
20
  "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); } }\""
21
+ "dev": "npx webpack --config webpack.config.js --watch"
31
22
  },
32
23
  "repository": {
33
24
  "type": "git",
@@ -43,18 +34,40 @@
43
34
  "type": "GitHub Sponsors ❤",
44
35
  "url": "https://github.com/sponsors/CoCreate-app"
45
36
  },
46
- "main": "./src/index.js",
47
- "devDependencies": {
48
- "css-loader": "^5.1.3",
49
- "esbuild": "^0.25.2",
50
- "esbuild-loader": "^4.3.0",
51
- "mini-css-extract-plugin": "^1.5.0",
52
- "webpack": "^5.24.4",
53
- "webpack-cli": "^4.5.0",
54
- "webpack-log": "^3.0.1"
37
+ "type": "module",
38
+ "main": "./src/server.js",
39
+ "browser": "./src/client.js",
40
+ "exports": {
41
+ ".": {
42
+ "node": "./src/server.js",
43
+ "deno": "./src/server.js",
44
+ "browser": "./src/client.js",
45
+ "default": "./src/server.js"
46
+ }
55
47
  },
56
48
  "dependencies": {
57
- "@cocreate/crud-client": "^1.34.2",
58
- "@cocreate/uuid": "^1.12.1"
49
+ "@cocreate/crud-client": "^1.34.6",
50
+ "@cocreate/uuid": "^1.12.4"
51
+ },
52
+ "devDependencies": {
53
+ "@cocreate/webpack": "^1.4.3"
54
+ },
55
+ "allowScripts": {
56
+ "@cocreate/actions@1.21.4": true,
57
+ "@cocreate/api@1.22.5": true,
58
+ "@cocreate/config@1.13.4": true,
59
+ "@cocreate/crud-client@1.34.6": true,
60
+ "@cocreate/element-prototype@1.31.4": true,
61
+ "@cocreate/elements@1.42.9": true,
62
+ "@cocreate/filter@1.33.6": true,
63
+ "@cocreate/indexeddb@1.23.4": true,
64
+ "@cocreate/local-storage@1.16.5": true,
65
+ "@cocreate/observer@1.19.0": true,
66
+ "@cocreate/organizations@1.30.1": true,
67
+ "@cocreate/render@1.46.1": true,
68
+ "@cocreate/socket-client@1.40.5": true,
69
+ "@cocreate/utils@1.42.2": true,
70
+ "@cocreate/uuid@1.12.4": true,
71
+ "@cocreate/webpack@1.4.3": true
59
72
  }
60
73
  }
package/release.config.js CHANGED
@@ -1,4 +1,4 @@
1
- module.exports = {
1
+ export default {
2
2
  dryRun: false,
3
3
  branches: ["master"],
4
4
  plugins: [
@@ -10,12 +10,20 @@ module.exports = {
10
10
  changelogFile: "CHANGELOG.md",
11
11
  },
12
12
  ],
13
- "@semantic-release/npm",
14
- "@semantic-release/github",
13
+ "@semantic-release/npm",
15
14
  [
16
- "@semantic-release/git",
15
+ "@semantic-release/github",
17
16
  {
17
+ successComment: false,
18
+ failTitle: false,
19
+ },
20
+ ],
21
+ [
22
+ "@semantic-release/git",
23
+ {
24
+ // Only stage and commit the changelog and package.json
18
25
  assets: ["CHANGELOG.md", "package.json"],
26
+ message: "chore(release): ${nextRelease.version} [skip ci]",
19
27
  },
20
28
  ],
21
29
  ],
package/src/server.js CHANGED
@@ -1,46 +1,76 @@
1
- class CoCreateUnique {
2
- /**
3
- * @param crud
4
- */
5
- constructor(crud) {
6
- this.wsManager = crud.wsManager;
7
- this.crud = crud;
8
- this.init();
9
- }
10
-
11
- init() {
12
- if (this.wsManager) {
13
- this.wsManager.on("isUnique", (data) => this.isUnique(data));
14
- }
15
- }
16
-
17
- /**
18
- * Checks if a object is unique by sending a message to the socket. This is a blocking call so it returns a Promise
19
- *
20
- * @param socket - the socket to send the message to
21
- * @param data - the data to read from the database usually an object
22
- *
23
- * @return { Promise } - resolves with the response from the server or rejects with an error if there was a
24
- */
25
- async isUnique(data) {
26
- const self = this;
27
- try {
28
- data.method = "object.read";
29
- this.crud.send(data).then((data) => {
30
- data.method = "isUnique";
31
-
32
- if (data.object.length) {
33
- data.unique = false;
34
- } else {
35
- data.unique = true;
36
- }
37
-
38
- return self.wsManager.send(data);
39
- });
40
- } catch (error) {
41
- console.log(error);
42
- }
43
- }
1
+ /********************************************************************************
2
+ * Copyright (C) 2023 CoCreate and Contributors.
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify
5
+ * it under the terms of the GNU Affero General Public License as published
6
+ * by the Free Software Foundation, either version 3 of the License, or
7
+ * (at your option) any later version.
8
+ *
9
+ * This program is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ * GNU Affero General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Affero General Public License
15
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
16
+ *
17
+ ********************************************************************************/
18
+
19
+ // Commercial Licensing Information:
20
+ // For commercial use of this software without the copyleft provisions of the AGPLv3,
21
+ // you must obtain a commercial license from CoCreate LLC.
22
+ // For details, visit <https://cocreate.app/licenses/> or contact us at sales@cocreate.app.
23
+
24
+ import server from '@cocreate/server';
25
+
26
+ /**
27
+ * Checks if a specific database record/object is unique by executing a read query.
28
+ * Normalizes the response and transmits the unique state back to the requesting client.
29
+ *
30
+ * @param {Object} data - The query parameters and filter criteria for the uniqueness check
31
+ */
32
+ async function isUnique(data) {
33
+ try {
34
+ data.method = "object.read";
35
+
36
+ // Execute the database check using our dynamically resolved CRUD singleton
37
+ if (server && server.crud) {
38
+ const result = await server.crud.send(data);
39
+ result.method = "isUnique";
40
+
41
+ // Determine uniqueness based on result existence in the document payload array
42
+ if (result.object && result.object.length) {
43
+ result.unique = false;
44
+ } else {
45
+ result.unique = true;
46
+ }
47
+
48
+ // Return the final result payload back to the client socket pipeline
49
+ if (server.wsManager) {
50
+ server.wsManager.send(result);
51
+ }
52
+ }
53
+ } catch (error) {
54
+ console.error("[@cocreate/unique] Error resolving isUnique constraint:", error);
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Auto-initialization loop.
60
+ * Silently polls to verify that the unified server orchestrator is fully loaded,
61
+ * and that both the database (crud) and socket manager (wsManager) have completed
62
+ * their initial handshakes, then attaches active database uniqueness verification handlers.
63
+ */
64
+ function init() {
65
+ if (server && server.isInitialized && server.crud && server.wsManager) {
66
+ server.wsManager.on("isUnique", (data) => isUnique(data));
67
+ } else {
68
+ // If the server and WebSocket managers are not yet ready, retry in 500ms
69
+ setTimeout(init, 500);
70
+ }
44
71
  }
45
72
 
46
- module.exports = CoCreateUnique;
73
+ // Auto-execute initialization instantly upon module load
74
+ init();
75
+
76
+ export default init;
package/src/index.js DELETED
@@ -1,15 +0,0 @@
1
- // Check if browser, return client or server file
2
- (function (root, factory) {
3
- if (typeof define === 'function' && define.amd) {
4
- define(["./client.js"], function (CoCreateUnique) {
5
- return factory(CoCreateUnique)
6
- });
7
- } else if (typeof module === 'object' && module.exports) {
8
- const CoCreateUnique = require("./server.js")
9
- module.exports = factory(CoCreateUnique);
10
- } else {
11
- root.returnExports = factory(root["./client.js"]);
12
- }
13
- }(typeof self !== 'undefined' ? self : this, function (CoCreateUnique) {
14
- return CoCreateUnique;
15
- }));