@hot-updater/plugin-core 0.36.7 → 1.0.0-rc.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.
Files changed (161) hide show
  1. package/dist/assetStorageLayout.cjs +36 -18
  2. package/dist/assetStorageLayout.d.cts +21 -6
  3. package/dist/assetStorageLayout.d.mts +21 -6
  4. package/dist/assetStorageLayout.mjs +36 -18
  5. package/dist/bundleStorageLayout.cjs +2 -3
  6. package/dist/bundleStorageLayout.mjs +2 -3
  7. package/dist/contentAddressedAssets.cjs +5 -0
  8. package/dist/contentAddressedAssets.d.cts +2 -1
  9. package/dist/contentAddressedAssets.d.mts +2 -1
  10. package/dist/contentAddressedAssets.mjs +5 -1
  11. package/dist/createDatabasePlugin.cjs +775 -284
  12. package/dist/createDatabasePlugin.d.cts +20 -64
  13. package/dist/createDatabasePlugin.d.mts +20 -64
  14. package/dist/createDatabasePlugin.mjs +773 -284
  15. package/dist/createStorageKeyBuilder.cjs +9 -2
  16. package/dist/createStorageKeyBuilder.mjs +9 -2
  17. package/dist/createStoragePlugin.cjs +6 -145
  18. package/dist/createStoragePlugin.d.cts +7 -52
  19. package/dist/createStoragePlugin.d.mts +7 -52
  20. package/dist/createStoragePlugin.mjs +5 -143
  21. package/dist/databaseClient.cjs +112 -0
  22. package/dist/databaseClient.d.cts +33 -0
  23. package/dist/databaseClient.d.mts +33 -0
  24. package/dist/databaseClient.mjs +110 -0
  25. package/dist/databaseClientReads.cjs +113 -0
  26. package/dist/databaseClientReads.mjs +112 -0
  27. package/dist/databaseClientUpdates.cjs +39 -0
  28. package/dist/databaseClientUpdates.d.cts +11 -0
  29. package/dist/databaseClientUpdates.d.mts +11 -0
  30. package/dist/databaseClientUpdates.mjs +36 -0
  31. package/dist/databaseJsonValue.cjs +37 -0
  32. package/dist/databaseJsonValue.d.cts +5 -0
  33. package/dist/databaseJsonValue.d.mts +5 -0
  34. package/dist/databaseJsonValue.mjs +37 -0
  35. package/dist/databaseMetadata.cjs +13 -0
  36. package/dist/databaseMetadata.mjs +12 -0
  37. package/dist/databasePluginCrud.cjs +86 -0
  38. package/dist/databasePluginCrud.d.cts +1 -0
  39. package/dist/databasePluginCrud.d.mts +1 -0
  40. package/dist/databasePluginCrud.mjs +86 -0
  41. package/dist/databasePluginCrudValidation.d.cts +1 -0
  42. package/dist/databasePluginCrudValidation.d.mts +1 -0
  43. package/dist/databasePluginCrudValidationErrors.cjs +10 -0
  44. package/dist/databasePluginCrudValidationErrors.d.cts +9 -0
  45. package/dist/databasePluginCrudValidationErrors.d.mts +9 -0
  46. package/dist/databasePluginCrudValidationErrors.mjs +10 -0
  47. package/dist/databasePluginCrudValidationFields.cjs +291 -0
  48. package/dist/databasePluginCrudValidationFields.d.cts +1 -0
  49. package/dist/databasePluginCrudValidationFields.d.mts +1 -0
  50. package/dist/databasePluginCrudValidationFields.mjs +281 -0
  51. package/dist/databasePluginCrudValidationMutations.cjs +88 -0
  52. package/dist/databasePluginCrudValidationMutations.d.cts +1 -0
  53. package/dist/databasePluginCrudValidationMutations.d.mts +1 -0
  54. package/dist/databasePluginCrudValidationMutations.mjs +82 -0
  55. package/dist/databasePluginCrudValidationQueries.cjs +103 -0
  56. package/dist/databasePluginCrudValidationQueries.d.cts +1 -0
  57. package/dist/databasePluginCrudValidationQueries.d.mts +1 -0
  58. package/dist/databasePluginCrudValidationQueries.mjs +97 -0
  59. package/dist/databasePluginCrudValidationRows.cjs +55 -0
  60. package/dist/databasePluginCrudValidationRows.d.cts +1 -0
  61. package/dist/databasePluginCrudValidationRows.d.mts +1 -0
  62. package/dist/databasePluginCrudValidationRows.mjs +53 -0
  63. package/dist/databasePluginTransaction.cjs +7 -0
  64. package/dist/databasePluginTransaction.mjs +7 -0
  65. package/dist/databaseRows.cjs +149 -0
  66. package/dist/databaseRows.d.cts +34 -0
  67. package/dist/databaseRows.d.mts +34 -0
  68. package/dist/databaseRows.mjs +141 -0
  69. package/dist/index.cjs +76 -24
  70. package/dist/index.d.cts +22 -12
  71. package/dist/index.d.mts +22 -12
  72. package/dist/index.mjs +21 -14
  73. package/dist/internal.cjs +6 -0
  74. package/dist/internal.d.cts +9 -0
  75. package/dist/internal.d.mts +9 -0
  76. package/dist/internal.mjs +3 -0
  77. package/dist/node_modules/.pnpm/verkit@0.3.2/node_modules/verkit/dist/index.cjs +345 -0
  78. package/dist/node_modules/.pnpm/verkit@0.3.2/node_modules/verkit/dist/index.mjs +341 -0
  79. package/dist/paginateBundles.d.cts +6 -4
  80. package/dist/paginateBundles.d.mts +6 -4
  81. package/dist/parseStorageUri.cjs +46 -30
  82. package/dist/parseStorageUri.d.cts +20 -17
  83. package/dist/parseStorageUri.d.mts +20 -17
  84. package/dist/parseStorageUri.mjs +46 -30
  85. package/dist/queryBundles.cjs +1 -7
  86. package/dist/queryBundles.d.cts +3 -1
  87. package/dist/queryBundles.d.mts +3 -1
  88. package/dist/queryBundles.mjs +1 -7
  89. package/dist/releaseCatalogCompiler.cjs +391 -0
  90. package/dist/releaseCatalogCompiler.d.cts +55 -0
  91. package/dist/releaseCatalogCompiler.d.mts +55 -0
  92. package/dist/releaseCatalogCompiler.mjs +386 -0
  93. package/dist/releaseCatalogMutation.cjs +303 -0
  94. package/dist/releaseCatalogMutation.d.cts +86 -0
  95. package/dist/releaseCatalogMutation.d.mts +86 -0
  96. package/dist/releaseCatalogMutation.mjs +297 -0
  97. package/dist/releaseManagement.cjs +231 -0
  98. package/dist/releaseManagement.d.cts +48 -0
  99. package/dist/releaseManagement.d.mts +48 -0
  100. package/dist/releaseManagement.mjs +224 -0
  101. package/dist/remoteBundleSigning.cjs +296 -0
  102. package/dist/remoteBundleSigning.d.cts +43 -0
  103. package/dist/remoteBundleSigning.d.mts +43 -0
  104. package/dist/remoteBundleSigning.mjs +291 -0
  105. package/dist/requestBundleCache.cjs +22 -0
  106. package/dist/requestBundleCache.d.cts +9 -0
  107. package/dist/requestBundleCache.d.mts +9 -0
  108. package/dist/requestBundleCache.mjs +22 -0
  109. package/dist/semverSatisfies.cjs +3 -4
  110. package/dist/semverSatisfies.mjs +1 -1
  111. package/dist/storageDownloadPath.cjs +48 -0
  112. package/dist/storageDownloadPath.d.cts +15 -0
  113. package/dist/storageDownloadPath.d.mts +15 -0
  114. package/dist/storageDownloadPath.mjs +46 -0
  115. package/dist/types/database.d.cts +4 -0
  116. package/dist/types/database.d.mts +4 -0
  117. package/dist/types/databaseFields.cjs +92 -0
  118. package/dist/types/databaseFields.d.cts +12 -0
  119. package/dist/types/databaseFields.d.mts +12 -0
  120. package/dist/types/databaseFields.mjs +92 -0
  121. package/dist/types/databaseOperations.d.cts +173 -0
  122. package/dist/types/databaseOperations.d.mts +173 -0
  123. package/dist/types/databasePlugin.d.cts +240 -0
  124. package/dist/types/databasePlugin.d.mts +240 -0
  125. package/dist/types/databaseQuery.d.cts +47 -0
  126. package/dist/types/databaseQuery.d.mts +47 -0
  127. package/dist/types/databaseRows.d.cts +120 -0
  128. package/dist/types/databaseRows.d.mts +120 -0
  129. package/dist/types/index.d.cts +120 -162
  130. package/dist/types/index.d.mts +120 -162
  131. package/dist/types/internal.d.cts +7 -0
  132. package/dist/types/internal.d.mts +7 -0
  133. package/dist/types/public.d.cts +3 -0
  134. package/dist/types/public.d.mts +3 -0
  135. package/dist/uuidv7.cjs +9 -0
  136. package/dist/uuidv7.d.cts +4 -1
  137. package/dist/uuidv7.d.mts +4 -1
  138. package/dist/uuidv7.mjs +8 -1
  139. package/package.json +10 -5
  140. package/dist/bundleUnitOfWork.cjs +0 -158
  141. package/dist/bundleUnitOfWork.mjs +0 -158
  142. package/dist/bundleUnitOfWorkStore.cjs +0 -15
  143. package/dist/bundleUnitOfWorkStore.mjs +0 -15
  144. package/dist/createBlobDatabasePlugin.cjs +0 -382
  145. package/dist/createBlobDatabasePlugin.d.cts +0 -29
  146. package/dist/createBlobDatabasePlugin.d.mts +0 -29
  147. package/dist/createBlobDatabasePlugin.mjs +0 -381
  148. package/dist/legacyAssetStorageLayout.cjs +0 -12
  149. package/dist/legacyAssetStorageLayout.mjs +0 -12
  150. package/dist/requestUpdateBundleState.cjs +0 -26
  151. package/dist/requestUpdateBundleState.d.cts +0 -12
  152. package/dist/requestUpdateBundleState.d.mts +0 -12
  153. package/dist/requestUpdateBundleState.mjs +0 -24
  154. package/dist/resolveUpdateInfoFromBundles.cjs +0 -14
  155. package/dist/resolveUpdateInfoFromBundles.d.cts +0 -16
  156. package/dist/resolveUpdateInfoFromBundles.d.mts +0 -16
  157. package/dist/resolveUpdateInfoFromBundles.mjs +0 -13
  158. package/dist/storageProfile.cjs +0 -15
  159. package/dist/storageProfile.d.cts +0 -9
  160. package/dist/storageProfile.d.mts +0 -9
  161. package/dist/storageProfile.mjs +0 -12
@@ -1,158 +0,0 @@
1
- const require_queryBundles = require("./queryBundles.cjs");
2
- //#region src/bundleUnitOfWork.ts
3
- const resolveEntryValue = (entry) => entry.kind === "present" ? entry.bundle : null;
4
- var BundleUnitOfWork = class {
5
- entries = /* @__PURE__ */ new Map();
6
- pendingLoads = /* @__PURE__ */ new Map();
7
- changes = /* @__PURE__ */ new Map();
8
- seededIds = /* @__PURE__ */ new Set();
9
- seed(seeds) {
10
- for (const seed of seeds) {
11
- if (!seed) continue;
12
- this.seededIds.add(seed.id);
13
- if (!this.changes.has(seed.id)) this.entries.set(seed.id, {
14
- kind: "present",
15
- bundle: seed
16
- });
17
- }
18
- }
19
- hasSeeds() {
20
- return this.seededIds.size > 0;
21
- }
22
- seededBundles() {
23
- const bundles = [];
24
- for (const bundleId of this.seededIds) {
25
- const entry = this.entries.get(bundleId);
26
- if (entry?.kind === "present") bundles.push(entry.bundle);
27
- }
28
- return bundles;
29
- }
30
- peek(bundleId) {
31
- const entry = this.entries.get(bundleId);
32
- if (entry?.kind === "present") return entry.bundle;
33
- return null;
34
- }
35
- peekChanged(bundleId) {
36
- if (!this.changes.has(bundleId)) return { found: false };
37
- const entry = this.entries.get(bundleId);
38
- return {
39
- found: true,
40
- value: entry ? resolveEntryValue(entry) : null
41
- };
42
- }
43
- async getById(bundleId, loadBundleById) {
44
- const entry = this.entries.get(bundleId);
45
- if (entry) return resolveEntryValue(entry);
46
- const pendingLoad = this.pendingLoads.get(bundleId);
47
- if (pendingLoad) return pendingLoad;
48
- const load = loadBundleById().then((bundle) => {
49
- this.pendingLoads.delete(bundleId);
50
- const currentEntry = this.entries.get(bundleId);
51
- if (currentEntry) return resolveEntryValue(currentEntry);
52
- this.entries.set(bundleId, bundle ? {
53
- kind: "present",
54
- bundle
55
- } : { kind: "missing" });
56
- return bundle;
57
- }, (error) => {
58
- this.pendingLoads.delete(bundleId);
59
- throw error;
60
- });
61
- this.pendingLoads.set(bundleId, load);
62
- return load;
63
- }
64
- overlayList(bundles, options) {
65
- const dataById = /* @__PURE__ */ new Map();
66
- for (const bundle of bundles) {
67
- const entry = this.entries.get(bundle.id);
68
- if (entry?.kind === "deleted") continue;
69
- if (entry?.kind === "present") {
70
- if (require_queryBundles.bundleMatchesQueryWhere(entry.bundle, options.where)) dataById.set(entry.bundle.id, entry.bundle);
71
- continue;
72
- }
73
- this.entries.set(bundle.id, {
74
- kind: "present",
75
- bundle
76
- });
77
- dataById.set(bundle.id, bundle);
78
- }
79
- for (const change of this.changes.values()) {
80
- if (change.operation === "delete" || change.operation === "insert") {
81
- dataById.delete(change.data.id);
82
- continue;
83
- }
84
- if (require_queryBundles.bundleMatchesQueryWhere(change.data, options.where)) dataById.set(change.data.id, change.data);
85
- else dataById.delete(change.data.id);
86
- }
87
- return require_queryBundles.sortBundles(Array.from(dataById.values()), options.orderBy).slice(0, options.limit);
88
- }
89
- markInsert(bundle) {
90
- this.entries.set(bundle.id, {
91
- kind: "present",
92
- bundle
93
- });
94
- this.changes.set(bundle.id, {
95
- operation: "insert",
96
- data: bundle,
97
- before: null
98
- });
99
- }
100
- markUpdate(bundle) {
101
- const previousChange = this.changes.get(bundle.id);
102
- const previousEntry = this.entries.get(bundle.id);
103
- const operation = previousChange?.operation ?? "update";
104
- this.entries.set(bundle.id, {
105
- kind: "present",
106
- bundle
107
- });
108
- this.changes.set(bundle.id, {
109
- operation,
110
- data: bundle,
111
- before: previousChange?.before ?? (previousEntry ? resolveEntryValue(previousEntry) : null)
112
- });
113
- }
114
- markDelete(bundle) {
115
- const previousChange = this.changes.get(bundle.id);
116
- const previousEntry = this.entries.get(bundle.id);
117
- this.entries.set(bundle.id, {
118
- kind: "deleted",
119
- bundle
120
- });
121
- this.changes.set(bundle.id, {
122
- operation: "delete",
123
- data: bundle,
124
- before: previousChange?.before ?? (previousEntry ? resolveEntryValue(previousEntry) : bundle)
125
- });
126
- }
127
- changedSets() {
128
- return Array.from(this.changes.values(), ({ data, operation }) => ({
129
- operation,
130
- data
131
- }));
132
- }
133
- hasChanges() {
134
- return this.changes.size > 0;
135
- }
136
- listFetchExtraCount() {
137
- return Array.from(this.changes.values()).filter((change) => change.operation === "update" || change.operation === "delete").length;
138
- }
139
- totalDelta(where) {
140
- let total = 0;
141
- for (const change of this.changes.values()) {
142
- if (change.operation === "insert") continue;
143
- const matchedBefore = change.before !== null && require_queryBundles.bundleMatchesQueryWhere(change.before, where);
144
- const matchesAfter = change.operation === "update" && require_queryBundles.bundleMatchesQueryWhere(change.data, where);
145
- if (matchedBefore && !matchesAfter) total -= 1;
146
- else if (!matchedBefore && matchesAfter) total += 1;
147
- }
148
- return total;
149
- }
150
- clear() {
151
- this.entries.clear();
152
- this.pendingLoads.clear();
153
- this.changes.clear();
154
- this.seededIds.clear();
155
- }
156
- };
157
- //#endregion
158
- exports.BundleUnitOfWork = BundleUnitOfWork;
@@ -1,158 +0,0 @@
1
- import { bundleMatchesQueryWhere, sortBundles } from "./queryBundles.mjs";
2
- //#region src/bundleUnitOfWork.ts
3
- const resolveEntryValue = (entry) => entry.kind === "present" ? entry.bundle : null;
4
- var BundleUnitOfWork = class {
5
- entries = /* @__PURE__ */ new Map();
6
- pendingLoads = /* @__PURE__ */ new Map();
7
- changes = /* @__PURE__ */ new Map();
8
- seededIds = /* @__PURE__ */ new Set();
9
- seed(seeds) {
10
- for (const seed of seeds) {
11
- if (!seed) continue;
12
- this.seededIds.add(seed.id);
13
- if (!this.changes.has(seed.id)) this.entries.set(seed.id, {
14
- kind: "present",
15
- bundle: seed
16
- });
17
- }
18
- }
19
- hasSeeds() {
20
- return this.seededIds.size > 0;
21
- }
22
- seededBundles() {
23
- const bundles = [];
24
- for (const bundleId of this.seededIds) {
25
- const entry = this.entries.get(bundleId);
26
- if (entry?.kind === "present") bundles.push(entry.bundle);
27
- }
28
- return bundles;
29
- }
30
- peek(bundleId) {
31
- const entry = this.entries.get(bundleId);
32
- if (entry?.kind === "present") return entry.bundle;
33
- return null;
34
- }
35
- peekChanged(bundleId) {
36
- if (!this.changes.has(bundleId)) return { found: false };
37
- const entry = this.entries.get(bundleId);
38
- return {
39
- found: true,
40
- value: entry ? resolveEntryValue(entry) : null
41
- };
42
- }
43
- async getById(bundleId, loadBundleById) {
44
- const entry = this.entries.get(bundleId);
45
- if (entry) return resolveEntryValue(entry);
46
- const pendingLoad = this.pendingLoads.get(bundleId);
47
- if (pendingLoad) return pendingLoad;
48
- const load = loadBundleById().then((bundle) => {
49
- this.pendingLoads.delete(bundleId);
50
- const currentEntry = this.entries.get(bundleId);
51
- if (currentEntry) return resolveEntryValue(currentEntry);
52
- this.entries.set(bundleId, bundle ? {
53
- kind: "present",
54
- bundle
55
- } : { kind: "missing" });
56
- return bundle;
57
- }, (error) => {
58
- this.pendingLoads.delete(bundleId);
59
- throw error;
60
- });
61
- this.pendingLoads.set(bundleId, load);
62
- return load;
63
- }
64
- overlayList(bundles, options) {
65
- const dataById = /* @__PURE__ */ new Map();
66
- for (const bundle of bundles) {
67
- const entry = this.entries.get(bundle.id);
68
- if (entry?.kind === "deleted") continue;
69
- if (entry?.kind === "present") {
70
- if (bundleMatchesQueryWhere(entry.bundle, options.where)) dataById.set(entry.bundle.id, entry.bundle);
71
- continue;
72
- }
73
- this.entries.set(bundle.id, {
74
- kind: "present",
75
- bundle
76
- });
77
- dataById.set(bundle.id, bundle);
78
- }
79
- for (const change of this.changes.values()) {
80
- if (change.operation === "delete" || change.operation === "insert") {
81
- dataById.delete(change.data.id);
82
- continue;
83
- }
84
- if (bundleMatchesQueryWhere(change.data, options.where)) dataById.set(change.data.id, change.data);
85
- else dataById.delete(change.data.id);
86
- }
87
- return sortBundles(Array.from(dataById.values()), options.orderBy).slice(0, options.limit);
88
- }
89
- markInsert(bundle) {
90
- this.entries.set(bundle.id, {
91
- kind: "present",
92
- bundle
93
- });
94
- this.changes.set(bundle.id, {
95
- operation: "insert",
96
- data: bundle,
97
- before: null
98
- });
99
- }
100
- markUpdate(bundle) {
101
- const previousChange = this.changes.get(bundle.id);
102
- const previousEntry = this.entries.get(bundle.id);
103
- const operation = previousChange?.operation ?? "update";
104
- this.entries.set(bundle.id, {
105
- kind: "present",
106
- bundle
107
- });
108
- this.changes.set(bundle.id, {
109
- operation,
110
- data: bundle,
111
- before: previousChange?.before ?? (previousEntry ? resolveEntryValue(previousEntry) : null)
112
- });
113
- }
114
- markDelete(bundle) {
115
- const previousChange = this.changes.get(bundle.id);
116
- const previousEntry = this.entries.get(bundle.id);
117
- this.entries.set(bundle.id, {
118
- kind: "deleted",
119
- bundle
120
- });
121
- this.changes.set(bundle.id, {
122
- operation: "delete",
123
- data: bundle,
124
- before: previousChange?.before ?? (previousEntry ? resolveEntryValue(previousEntry) : bundle)
125
- });
126
- }
127
- changedSets() {
128
- return Array.from(this.changes.values(), ({ data, operation }) => ({
129
- operation,
130
- data
131
- }));
132
- }
133
- hasChanges() {
134
- return this.changes.size > 0;
135
- }
136
- listFetchExtraCount() {
137
- return Array.from(this.changes.values()).filter((change) => change.operation === "update" || change.operation === "delete").length;
138
- }
139
- totalDelta(where) {
140
- let total = 0;
141
- for (const change of this.changes.values()) {
142
- if (change.operation === "insert") continue;
143
- const matchedBefore = change.before !== null && bundleMatchesQueryWhere(change.before, where);
144
- const matchesAfter = change.operation === "update" && bundleMatchesQueryWhere(change.data, where);
145
- if (matchedBefore && !matchesAfter) total -= 1;
146
- else if (!matchedBefore && matchesAfter) total += 1;
147
- }
148
- return total;
149
- }
150
- clear() {
151
- this.entries.clear();
152
- this.pendingLoads.clear();
153
- this.changes.clear();
154
- this.seededIds.clear();
155
- }
156
- };
157
- //#endregion
158
- export { BundleUnitOfWork };
@@ -1,15 +0,0 @@
1
- const require_bundleUnitOfWork = require("./bundleUnitOfWork.cjs");
2
- //#region src/bundleUnitOfWorkStore.ts
3
- const requestUnitOfWorks = /* @__PURE__ */ new WeakMap();
4
- const isUnitOfWorkContext = (value) => typeof value === "object" && value !== null || typeof value === "function";
5
- const getRequestBundleUnitOfWork = (context) => {
6
- if (!isUnitOfWorkContext(context)) return null;
7
- let unitOfWork = requestUnitOfWorks.get(context);
8
- if (!unitOfWork) {
9
- unitOfWork = new require_bundleUnitOfWork.BundleUnitOfWork();
10
- requestUnitOfWorks.set(context, unitOfWork);
11
- }
12
- return unitOfWork;
13
- };
14
- //#endregion
15
- exports.getRequestBundleUnitOfWork = getRequestBundleUnitOfWork;
@@ -1,15 +0,0 @@
1
- import { BundleUnitOfWork } from "./bundleUnitOfWork.mjs";
2
- //#region src/bundleUnitOfWorkStore.ts
3
- const requestUnitOfWorks = /* @__PURE__ */ new WeakMap();
4
- const isUnitOfWorkContext = (value) => typeof value === "object" && value !== null || typeof value === "function";
5
- const getRequestBundleUnitOfWork = (context) => {
6
- if (!isUnitOfWorkContext(context)) return null;
7
- let unitOfWork = requestUnitOfWorks.get(context);
8
- if (!unitOfWork) {
9
- unitOfWork = new BundleUnitOfWork();
10
- requestUnitOfWorks.set(context, unitOfWork);
11
- }
12
- return unitOfWork;
13
- };
14
- //#endregion
15
- export { getRequestBundleUnitOfWork };