@krantho/persistence 0.0.0-stage → 1.0.1

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.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/dist/auth.d.ts +79 -0
  3. package/dist/auth.d.ts.map +1 -0
  4. package/dist/auth.js +2 -0
  5. package/dist/auth.js.map +1 -0
  6. package/dist/content-contract.d.ts +36 -0
  7. package/dist/content-contract.d.ts.map +1 -0
  8. package/dist/content-contract.js +70 -0
  9. package/dist/content-contract.js.map +1 -0
  10. package/dist/content-query.d.ts +48 -0
  11. package/dist/content-query.d.ts.map +1 -0
  12. package/dist/content-query.js +5 -0
  13. package/dist/content-query.js.map +1 -0
  14. package/dist/content-row.d.ts +59 -0
  15. package/dist/content-row.d.ts.map +1 -0
  16. package/dist/content-row.js +60 -0
  17. package/dist/content-row.js.map +1 -0
  18. package/dist/index.d.ts +503 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +36 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/live-version.d.ts +44 -0
  23. package/dist/live-version.d.ts.map +1 -0
  24. package/dist/live-version.js +74 -0
  25. package/dist/live-version.js.map +1 -0
  26. package/dist/migration-utils.d.ts +35 -0
  27. package/dist/migration-utils.d.ts.map +1 -0
  28. package/dist/migration-utils.js +50 -0
  29. package/dist/migration-utils.js.map +1 -0
  30. package/dist/migrations.d.ts +119 -0
  31. package/dist/migrations.d.ts.map +1 -0
  32. package/dist/migrations.js +2 -0
  33. package/dist/migrations.js.map +1 -0
  34. package/dist/page-cache.d.ts +77 -0
  35. package/dist/page-cache.d.ts.map +1 -0
  36. package/dist/page-cache.js +65 -0
  37. package/dist/page-cache.js.map +1 -0
  38. package/dist/repository-content.d.ts +45 -0
  39. package/dist/repository-content.d.ts.map +1 -0
  40. package/dist/repository-content.js +94 -0
  41. package/dist/repository-content.js.map +1 -0
  42. package/dist/sort-columns.d.ts +19 -0
  43. package/dist/sort-columns.d.ts.map +1 -0
  44. package/dist/sort-columns.js +21 -0
  45. package/dist/sort-columns.js.map +1 -0
  46. package/package.json +35 -3
  47. package/README.md +0 -3
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The ORDER BY whitelist shared by every SQL adapter.
3
+ *
4
+ * A sort field arrives from a query string, so it can never be interpolated
5
+ * into SQL unchecked. Columns named here are emitted literally; anything else
6
+ * falls back to each adapter's JSON extraction expression, and only when it
7
+ * matches {@link SORT_FIELD_PATTERN}. Both adapters read these values from here
8
+ * so the two whitelists cannot drift apart.
9
+ */
10
+ export const DIRECT_SORT_COLUMNS = ['slug', 'status', 'locale', 'created_at'];
11
+ /** Characters allowed in a content field name used as a sort key */
12
+ export const SORT_FIELD_PATTERN = /^[\w-]+$/;
13
+ /** Whether a sort field names a content table column that can be sorted directly */
14
+ export function isDirectSortColumn(field) {
15
+ return DIRECT_SORT_COLUMNS.includes(field);
16
+ }
17
+ /** Whether a sort field is safe to interpolate into a JSON extraction expression */
18
+ export function isSafeSortField(field) {
19
+ return SORT_FIELD_PATTERN.test(field);
20
+ }
21
+ //# sourceMappingURL=sort-columns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sort-columns.js","sourceRoot":"","sources":["../src/sort-columns.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,CAAU,CAAA;AAKtF,oEAAoE;AACpE,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAA;AAE5C,oFAAoF;AACpF,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,OAAQ,mBAAyC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AACnE,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,OAAO,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AACvC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,38 @@
1
1
  {
2
2
  "name": "@krantho/persistence",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.1",
4
+ "description": "The krantho persistence contract: the interfaces for content, versions, media, auth, SEO configuration and the shared page cache.",
5
+ "license": "MIT",
6
+ "homepage": "https://krantho.com",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/descoped/krantho.git",
10
+ "directory": "packages/persistence"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/descoped/krantho/issues"
14
+ },
15
+ "type": "module",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "import": "./dist/index.js"
20
+ }
21
+ },
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "dependencies": {
26
+ "yaml": "^2.9.1",
27
+ "@krantho/core": "1.0.1",
28
+ "@krantho/seo-shared": "1.0.1"
29
+ },
30
+ "devDependencies": {
31
+ "typescript": "^6.0.3"
32
+ },
33
+ "scripts": {
34
+ "build": "tsc",
35
+ "typecheck": "tsc --noEmit",
36
+ "clean": "rm -rf dist"
37
+ }
6
38
  }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.