datastore-api 6.0.2 → 6.2.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/package.json CHANGED
@@ -1,71 +1,5 @@
1
1
  {
2
- "name": "datastore-api",
3
- "version": "6.0.2",
4
- "description": "Simplified, more consitent API for Google Cloud Datastore",
5
- "keywords": [
6
- "datastore",
7
- "google cloud"
8
- ],
9
- "homepage": "http://github.com/mdornseif/datastore-api/",
10
- "repository": "https://github.com/mdornseif/datastore-api",
11
- "license": "MIT",
12
2
  "author": "Maximillian Dornseif",
13
- "main": "dist/index.js",
14
- "module": "dist/datastore-api2.esm.js",
15
- "typings": "dist/index.d.ts",
16
- "files": [
17
- "dist",
18
- "src"
19
- ],
20
- "scripts": {
21
- "analyze": "size-limit --why",
22
- "build": "dts build",
23
- "doc": "typedoc src/ --exclude **/*.spec.ts --out build/docs",
24
- "lint": "dts lint",
25
- "size": "size-limit",
26
- "start": "dts watch",
27
- "test": "vitest",
28
- "unimported": "npx unimported; npx findead src"
29
- },
30
- "husky": {
31
- "hooks": {
32
- "pre-commit": "lint-staged"
33
- }
34
- },
35
- "lint-staged": {
36
- "*{css,scss,md,markdown,json,yaml,yml,graphql,html}": "npx prettier -w",
37
- "*{js,jsx,ts,tsx}": [
38
- "npx prettier -w",
39
- "npm run lint --fix"
40
- ],
41
- "package.json": "sort-package-json"
42
- },
43
- "config": {
44
- "commitizen": {
45
- "path": "cz-conventional-changelog"
46
- }
47
- },
48
- "prettier": {
49
- "printWidth": 110,
50
- "semi": true,
51
- "singleQuote": true,
52
- "trailingComma": "es5"
53
- },
54
- "release": {
55
- "branches": [
56
- "main",
57
- "master",
58
- "next"
59
- ],
60
- "plugins": [
61
- "@semantic-release/commit-analyzer",
62
- "@semantic-release/release-notes-generator",
63
- "@semantic-release/changelog",
64
- "@semantic-release/git",
65
- "@semantic-release/github",
66
- "@semantic-release/npm"
67
- ]
68
- },
69
3
  "ava": {
70
4
  "failFast": true,
71
5
  "files": [
@@ -78,70 +12,134 @@
78
12
  }
79
13
  }
80
14
  },
81
- "nyc": {
82
- "exclude": [
83
- "**/*.spec.js"
84
- ],
85
- "extends": "@istanbuljs/nyc-config-typescript"
15
+ "config": {
16
+ "commitizen": {
17
+ "path": "cz-conventional-changelog"
18
+ }
86
19
  },
87
20
  "dependencies": {
88
21
  "@google-cloud/datastore": ">=7.0.0",
89
22
  "assertate-debug": "^2.4.2",
90
23
  "prom-client": ">=14.0.0"
91
24
  },
25
+ "description": "Simplified, more consistent API for Google Cloud Datastore",
92
26
  "devDependencies": {
93
- "@google-cloud/promisify": "^3.0.1",
94
- "@istanbuljs/nyc-config-typescript": "^1.0.1",
27
+ "@google-cloud/promisify": ">=4.0.0",
28
+ "@istanbuljs/nyc-config-typescript": "^1.0.2",
95
29
  "@semantic-release/changelog": "^6.0.3",
96
30
  "@semantic-release/commit-analyzer": "^11.1.0",
97
31
  "@semantic-release/git": "^10.0.1",
98
32
  "@semantic-release/github": "^9.2.6",
99
- "@semantic-release/npm": "^11.0.2",
33
+ "@semantic-release/npm": "^11.0.3",
100
34
  "@semantic-release/release-notes-generator": "^12.1.0",
101
- "@size-limit/preset-small-lib": "^8.2.6",
102
- "@tsconfig/recommended": "^1.0.2",
103
- "@types/debug": "^4.1.8",
104
- "@types/is": "^0.0.22",
105
- "@types/node": "^20.3.3",
106
- "@typescript-eslint/eslint-plugin": "^6.18.1",
107
- "@typescript-eslint/parser": "^6.18.1",
108
- "codecov": "^3.5.0",
35
+ "@tsconfig/recommended": "^1.0.3",
36
+ "@types/debug": "^4.1.12",
37
+ "@types/is": "^0.0.25",
38
+ "@types/node": "^20.11.24",
39
+ "@typescript-eslint/eslint-plugin": "^7.1.0",
40
+ "@typescript-eslint/parser": "^7.1.0",
41
+ "codecov": "^3.8.3",
109
42
  "cspell": "5.14.0",
110
43
  "cz-conventional-changelog": "^3.3.0",
111
- "debug": "^4.3.3",
112
- "dts-cli": "^2.0.4",
113
- "eslint": "^8.56.0",
44
+ "debug": "^4.3.4",
45
+ "dts-cli": "^2.0.5",
46
+ "eslint": "^8.57.0",
114
47
  "eslint-config-prettier": "^9.1.0",
115
48
  "eslint-plugin-eslint-comments": "^3.2.0",
116
49
  "eslint-plugin-flowtype": "^8.0.3",
117
50
  "eslint-plugin-import": "^2.29.1",
118
51
  "eslint-plugin-jsx-a11y": "^6.8.0",
119
52
  "eslint-plugin-prettier": "^5.1.3",
120
- "eslint-plugin-react": "^7.33.2",
53
+ "eslint-plugin-react": "^7.34.0",
121
54
  "eslint-plugin-react-hooks": "^4.6.0",
122
55
  "gh-pages": "^5.0.0",
123
56
  "google-datastore-emulator": ">=7.0.0",
124
- "husky": "^8.0.3",
125
- "lint-staged": "^13.2.3",
57
+ "husky": "^9.0.11",
58
+ "lint-staged": "^15.2.2",
126
59
  "npm-run-all": "^4.1.5",
127
60
  "nyc": "^15.1.0",
128
- "open-cli": "7.2.0",
129
- "prettier": "^3.2.2",
61
+ "open-cli": "8.0.0",
62
+ "prettier": "^3.2.5",
130
63
  "semantic-release": "^23.0.0",
131
- "size-limit": "^8.2.6",
132
- "sort-package-json": "^2.5.0",
133
- "standard-version": "^9.0.0",
134
- "ts-essentials": "9.3.2",
135
- "ts-node": "^10.4.0",
136
- "tslib": "^2.6.0",
137
- "typedoc": "0.24.8",
138
- "typescript": "<5.1.0",
139
- "vitest": "^0.32.2"
64
+ "sort-package-json": "^2.8.0",
65
+ "standard-version": "^9.5.0",
66
+ "ts-essentials": "9.4.1",
67
+ "ts-node": "^10.9.2",
68
+ "tslib": "^2.6.2",
69
+ "typedoc": "0.25.10",
70
+ "typescript": "^5.3.3",
71
+ "vitest": "^1.3.1"
72
+ },
73
+ "engines": {
74
+ "node": ">=16"
75
+ },
76
+ "files": [
77
+ "dist",
78
+ "src"
79
+ ],
80
+ "homepage": "http://github.com/mdornseif/datastore-api/",
81
+ "husky": {
82
+ "hooks": {
83
+ "pre-commit": "lint-staged"
84
+ }
85
+ },
86
+ "keywords": [
87
+ "datastore",
88
+ "google cloud"
89
+ ],
90
+ "license": "MIT",
91
+ "lint-staged": {
92
+ "*{css,scss,md,markdown,json,yaml,yml,graphql,html}": "npx prettier -w",
93
+ "*{js,jsx,ts,tsx}": [
94
+ "npx prettier -w",
95
+ "npm run lint --fix"
96
+ ],
97
+ "package.json": "sort-package-json"
98
+ },
99
+ "main": "dist/index.js",
100
+ "module": "dist/datastore-api2.esm.js",
101
+ "name": "datastore-api",
102
+ "nyc": {
103
+ "exclude": [
104
+ "**/*.spec.js"
105
+ ],
106
+ "extends": "@istanbuljs/nyc-config-typescript"
140
107
  },
141
108
  "peerDependencies": {
142
109
  "debug": ">=4.0.0"
143
110
  },
144
- "engines": {
145
- "node": ">=16"
146
- }
111
+ "prettier": {
112
+ "printWidth": 110,
113
+ "semi": false,
114
+ "singleQuote": true,
115
+ "trailingComma": "es5"
116
+ },
117
+ "release": {
118
+ "branches": [
119
+ "main",
120
+ "master",
121
+ "next"
122
+ ],
123
+ "plugins": [
124
+ "@semantic-release/commit-analyzer",
125
+ "@semantic-release/release-notes-generator",
126
+ "@semantic-release/changelog",
127
+ "@semantic-release/npm",
128
+ "@semantic-release/git",
129
+ "@semantic-release/github"
130
+ ]
131
+ },
132
+ "repository": "https://github.com/mdornseif/datastore-api",
133
+ "scripts": {
134
+ "build": "dts build",
135
+ "doc": "typedoc src/ --exclude **/*.spec.ts --out build/docs",
136
+ "lint": "dts lint",
137
+ "size": "npx vite-bundle-visualizer -t sunburst # npx source-map-explorer dist/index.js",
138
+ "start": "dts watch",
139
+ "test": "vitest",
140
+ "unimported": "npx findead src ; npx unimported; npx depcheck",
141
+ "update": "npx npm-check-updates --interactive"
142
+ },
143
+ "typings": "dist/index.d.ts",
144
+ "version": "6.2.0"
147
145
  }
package/src/index.ts CHANGED
@@ -1 +1,2 @@
1
- export * from './lib/dstore-api';
1
+ export * from './lib/dstore-api'
2
+ export * from './lib/assert'
@@ -0,0 +1,52 @@
1
+ /*
2
+ * assert.ts
3
+ *
4
+ * Created by Dr. Maximillian Dornseif 2025-04-11 in datastore-api 6.0.1
5
+ */
6
+
7
+ import { Datastore, Key } from './dstore-api'
8
+ import { AssertionMessageType, assert, getType } from 'assertate-debug'
9
+
10
+ /**
11
+ * Generates an type assertion message for the given `value`
12
+ *
13
+ * @param value value being type-checked
14
+ * @param type the expected value as a string; eg 'string', 'boolean', 'number'
15
+ * @param variableName the name of the variable being type-checked
16
+ * @param additionalMessage further information on failure
17
+ */
18
+ let AssertionMessage: AssertionMessageType = (
19
+ value,
20
+ type,
21
+ variableName?,
22
+ additionalMessage?
23
+ ): string => {
24
+ let message = variableName
25
+ ? `${variableName} must be of type '${type}', '${getType(value)}' provided`
26
+ : `expected value of type '${type}', '${getType(value)}' provided`
27
+ return additionalMessage ? `${message}: ${additionalMessage}` : message
28
+ }
29
+
30
+ /**
31
+ * Type-checks the provided `value` to be a symbol, throws an Error if it is not
32
+ *
33
+ * @param value the value to type-check as a symbol
34
+ * @param variableName the name of the variable to be type-checked
35
+ * @param additionalMessage further information on failure
36
+ * @throws {Error}
37
+ */
38
+ export function assertIsKey(
39
+ value: unknown,
40
+ variableName?: string,
41
+ additionalMessage?: string
42
+ ): asserts value is Key {
43
+ assert(
44
+ Datastore.isKey(value as any),
45
+ AssertionMessage(value, "Key", variableName, additionalMessage)
46
+ )
47
+ }
48
+
49
+
50
+
51
+
52
+