@cocreate/unique 1.20.5 → 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.
- package/.github/workflows/automated.yml +23 -10
- package/.github/workflows/manual.yml +1 -2
- package/CHANGELOG.md +21 -0
- package/package.json +35 -14
- package/release.config.js +12 -4
- package/src/server.js +74 -44
- package/src/index.js +0 -15
|
@@ -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,26 +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
28
|
uses: actions/checkout@v4
|
|
29
|
+
with:
|
|
30
|
+
fetch-depth: 0 # Required so semantic-release can trace git tags/history
|
|
31
|
+
|
|
26
32
|
- name: Setup Node.js
|
|
27
33
|
uses: actions/setup-node@v4
|
|
28
34
|
with:
|
|
29
|
-
node-version: 22
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
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_TOKEN }}"
|
|
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 }}"
|
|
56
|
+
new_release_version: "${{ steps.semantic.outputs.new_release_version }}"
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
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
|
+
|
|
1
22
|
## [1.20.5](https://github.com/CoCreate-app/CoCreate-unique/compare/v1.20.4...v1.20.5) (2026-02-04)
|
|
2
23
|
|
|
3
24
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/unique",
|
|
3
|
-
"version": "1.
|
|
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",
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
"scripts": {
|
|
19
19
|
"start": "npx webpack --config webpack.config.js",
|
|
20
20
|
"build": "npx webpack --mode=production --config webpack.config.js",
|
|
21
|
-
"dev": "npx webpack --config webpack.config.js --watch"
|
|
22
|
-
"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"
|
|
23
22
|
},
|
|
24
23
|
"repository": {
|
|
25
24
|
"type": "git",
|
|
@@ -35,18 +34,40 @@
|
|
|
35
34
|
"type": "GitHub Sponsors ❤",
|
|
36
35
|
"url": "https://github.com/sponsors/CoCreate-app"
|
|
37
36
|
},
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
+
}
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@cocreate/crud-client": "^1.34.
|
|
50
|
-
"@cocreate/uuid": "^1.12.
|
|
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
|
|
51
72
|
}
|
|
52
73
|
}
|
package/release.config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
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/
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
|
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
|
-
}));
|