@objectstack/cloud-connection 9.11.0 → 10.0.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/dist/index.cjs +57 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +57 -8
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.d.cts
CHANGED
|
@@ -194,6 +194,14 @@ declare class MarketplaceInstallLocalPlugin implements Plugin$1 {
|
|
|
194
194
|
private readonly ledger;
|
|
195
195
|
private readonly storageDir;
|
|
196
196
|
private readonly credentials;
|
|
197
|
+
/**
|
|
198
|
+
* Manifest ids already present in the engine registry at `kernel:ready`,
|
|
199
|
+
* BEFORE this plugin rehydrates its own ledger. These are genuine
|
|
200
|
+
* user/config-defined apps (AppPlugin from objectstack.config.ts). Used by
|
|
201
|
+
* findConflict to tell real local code apart from an orphaned marketplace
|
|
202
|
+
* install whose ledger entry went missing.
|
|
203
|
+
*/
|
|
204
|
+
private readonly bootUserCodeIds;
|
|
197
205
|
constructor(config?: MarketplaceInstallLocalPluginConfig);
|
|
198
206
|
init: (_ctx: PluginContext$1) => Promise<void>;
|
|
199
207
|
start: (ctx: PluginContext$1) => Promise<void>;
|
|
@@ -218,6 +226,12 @@ declare class MarketplaceInstallLocalPlugin implements Plugin$1 {
|
|
|
218
226
|
* (refuse to avoid silently overwriting authored code)
|
|
219
227
|
*/
|
|
220
228
|
private findConflict;
|
|
229
|
+
/**
|
|
230
|
+
* Record the manifest ids the engine registry already holds, called once at
|
|
231
|
+
* `kernel:ready` before rehydrate. Best-effort: a missing/empty registry
|
|
232
|
+
* just yields an empty snapshot (every later install is treated as fresh).
|
|
233
|
+
*/
|
|
234
|
+
private captureBootUserCodeIds;
|
|
221
235
|
/**
|
|
222
236
|
* Pull a userId out of the request's better-auth session, if any.
|
|
223
237
|
* Returns null when there is no signed-in user. v1 does not check
|
|
@@ -735,7 +749,7 @@ declare const CLOUD_CONNECTION_UI_BUNDLE: {
|
|
|
735
749
|
sourceView?: string | undefined;
|
|
736
750
|
appearance?: {
|
|
737
751
|
showDescription: boolean;
|
|
738
|
-
allowedVisualizations?: ("map" | "grid" | "kanban" | "gallery" | "calendar" | "timeline" | "gantt" | "chart")[] | undefined;
|
|
752
|
+
allowedVisualizations?: ("map" | "tree" | "grid" | "kanban" | "gallery" | "calendar" | "timeline" | "gantt" | "chart")[] | undefined;
|
|
739
753
|
} | undefined;
|
|
740
754
|
userFilters?: {
|
|
741
755
|
element: "tabs" | "toggle" | "dropdown";
|
package/dist/index.d.ts
CHANGED
|
@@ -194,6 +194,14 @@ declare class MarketplaceInstallLocalPlugin implements Plugin$1 {
|
|
|
194
194
|
private readonly ledger;
|
|
195
195
|
private readonly storageDir;
|
|
196
196
|
private readonly credentials;
|
|
197
|
+
/**
|
|
198
|
+
* Manifest ids already present in the engine registry at `kernel:ready`,
|
|
199
|
+
* BEFORE this plugin rehydrates its own ledger. These are genuine
|
|
200
|
+
* user/config-defined apps (AppPlugin from objectstack.config.ts). Used by
|
|
201
|
+
* findConflict to tell real local code apart from an orphaned marketplace
|
|
202
|
+
* install whose ledger entry went missing.
|
|
203
|
+
*/
|
|
204
|
+
private readonly bootUserCodeIds;
|
|
197
205
|
constructor(config?: MarketplaceInstallLocalPluginConfig);
|
|
198
206
|
init: (_ctx: PluginContext$1) => Promise<void>;
|
|
199
207
|
start: (ctx: PluginContext$1) => Promise<void>;
|
|
@@ -218,6 +226,12 @@ declare class MarketplaceInstallLocalPlugin implements Plugin$1 {
|
|
|
218
226
|
* (refuse to avoid silently overwriting authored code)
|
|
219
227
|
*/
|
|
220
228
|
private findConflict;
|
|
229
|
+
/**
|
|
230
|
+
* Record the manifest ids the engine registry already holds, called once at
|
|
231
|
+
* `kernel:ready` before rehydrate. Best-effort: a missing/empty registry
|
|
232
|
+
* just yields an empty snapshot (every later install is treated as fresh).
|
|
233
|
+
*/
|
|
234
|
+
private captureBootUserCodeIds;
|
|
221
235
|
/**
|
|
222
236
|
* Pull a userId out of the request's better-auth session, if any.
|
|
223
237
|
* Returns null when there is no signed-in user. v1 does not check
|
|
@@ -735,7 +749,7 @@ declare const CLOUD_CONNECTION_UI_BUNDLE: {
|
|
|
735
749
|
sourceView?: string | undefined;
|
|
736
750
|
appearance?: {
|
|
737
751
|
showDescription: boolean;
|
|
738
|
-
allowedVisualizations?: ("map" | "grid" | "kanban" | "gallery" | "calendar" | "timeline" | "gantt" | "chart")[] | undefined;
|
|
752
|
+
allowedVisualizations?: ("map" | "tree" | "grid" | "kanban" | "gallery" | "calendar" | "timeline" | "gantt" | "chart")[] | undefined;
|
|
739
753
|
} | undefined;
|
|
740
754
|
userFilters?: {
|
|
741
755
|
element: "tabs" | "toggle" | "dropdown";
|
package/dist/index.js
CHANGED
|
@@ -509,14 +509,26 @@ var ConnectionCredentialStore = class {
|
|
|
509
509
|
|
|
510
510
|
// src/marketplace-install-local-plugin.ts
|
|
511
511
|
var ROUTE_BASE = "/api/v1/marketplace/install-local";
|
|
512
|
+
function manifestIdOf(p) {
|
|
513
|
+
return p?.manifest?.id ?? p?.id ?? p?.manifest?.name ?? void 0;
|
|
514
|
+
}
|
|
512
515
|
var MarketplaceInstallLocalPlugin = class {
|
|
513
516
|
constructor(config = {}) {
|
|
514
517
|
this.name = "com.objectstack.runtime.marketplace-install-local";
|
|
515
518
|
this.version = "1.0.0";
|
|
519
|
+
/**
|
|
520
|
+
* Manifest ids already present in the engine registry at `kernel:ready`,
|
|
521
|
+
* BEFORE this plugin rehydrates its own ledger. These are genuine
|
|
522
|
+
* user/config-defined apps (AppPlugin from objectstack.config.ts). Used by
|
|
523
|
+
* findConflict to tell real local code apart from an orphaned marketplace
|
|
524
|
+
* install whose ledger entry went missing.
|
|
525
|
+
*/
|
|
526
|
+
this.bootUserCodeIds = /* @__PURE__ */ new Set();
|
|
516
527
|
this.init = async (_ctx) => {
|
|
517
528
|
};
|
|
518
529
|
this.start = async (ctx) => {
|
|
519
530
|
ctx.hook("kernel:ready", async () => {
|
|
531
|
+
this.captureBootUserCodeIds(ctx);
|
|
520
532
|
try {
|
|
521
533
|
const manifest = ctx.getService("manifest");
|
|
522
534
|
manifest?.register?.(MARKETPLACE_INSTALLED_UI_BUNDLE);
|
|
@@ -814,17 +826,35 @@ var MarketplaceInstallLocalPlugin = class {
|
|
|
814
826
|
if (this.ledger.has(manifestId)) {
|
|
815
827
|
return "marketplace";
|
|
816
828
|
}
|
|
829
|
+
if (this.bootUserCodeIds.has(manifestId)) {
|
|
830
|
+
return "user-code";
|
|
831
|
+
}
|
|
817
832
|
try {
|
|
818
833
|
const ql = ctx.getService("objectql");
|
|
819
834
|
const packages = ql?.registry?.getAllPackages?.() ?? [];
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
if (hit) return "user-code";
|
|
835
|
+
if (packages.some((p) => manifestIdOf(p) === manifestId)) {
|
|
836
|
+
return "marketplace";
|
|
837
|
+
}
|
|
824
838
|
} catch {
|
|
825
839
|
}
|
|
826
840
|
return "none";
|
|
827
841
|
};
|
|
842
|
+
/**
|
|
843
|
+
* Record the manifest ids the engine registry already holds, called once at
|
|
844
|
+
* `kernel:ready` before rehydrate. Best-effort: a missing/empty registry
|
|
845
|
+
* just yields an empty snapshot (every later install is treated as fresh).
|
|
846
|
+
*/
|
|
847
|
+
this.captureBootUserCodeIds = (ctx) => {
|
|
848
|
+
try {
|
|
849
|
+
const ql = ctx.getService("objectql");
|
|
850
|
+
const packages = ql?.registry?.getAllPackages?.() ?? [];
|
|
851
|
+
for (const p of packages) {
|
|
852
|
+
const id = manifestIdOf(p);
|
|
853
|
+
if (id) this.bootUserCodeIds.add(id);
|
|
854
|
+
}
|
|
855
|
+
} catch {
|
|
856
|
+
}
|
|
857
|
+
};
|
|
828
858
|
/**
|
|
829
859
|
* Pull a userId out of the request's better-auth session, if any.
|
|
830
860
|
* Returns null when there is no signed-in user. v1 does not check
|
|
@@ -870,6 +900,20 @@ var MarketplaceInstallLocalPlugin = class {
|
|
|
870
900
|
}
|
|
871
901
|
}, 400);
|
|
872
902
|
}
|
|
903
|
+
const inserted = summary.seeded.inserted ?? 0;
|
|
904
|
+
const updated = summary.seeded.updated ?? 0;
|
|
905
|
+
const errors = summary.seeded.errors ?? 0;
|
|
906
|
+
const wrote = inserted + updated > 0;
|
|
907
|
+
if (!wrote) {
|
|
908
|
+
return c.json({
|
|
909
|
+
success: false,
|
|
910
|
+
error: {
|
|
911
|
+
code: "reseed_no_rows",
|
|
912
|
+
message: errors > 0 ? `Reseed wrote no rows (${errors} error${errors === 1 ? "" : "s"}).${summary.seeded.errorSample ? ` First error: ${summary.seeded.errorSample}` : ""}` : "Reseed wrote no rows. The package declares no seedable records for this runtime.",
|
|
913
|
+
details: { inserted, updated, errors }
|
|
914
|
+
}
|
|
915
|
+
}, 422);
|
|
916
|
+
}
|
|
873
917
|
try {
|
|
874
918
|
entry.withSampleData = true;
|
|
875
919
|
this.ledger.write(entry);
|
|
@@ -879,9 +923,9 @@ var MarketplaceInstallLocalPlugin = class {
|
|
|
879
923
|
success: true,
|
|
880
924
|
data: {
|
|
881
925
|
manifestId,
|
|
882
|
-
inserted
|
|
883
|
-
updated
|
|
884
|
-
errors
|
|
926
|
+
inserted,
|
|
927
|
+
updated,
|
|
928
|
+
errors,
|
|
885
929
|
withSampleData: true
|
|
886
930
|
}
|
|
887
931
|
}, 200);
|
|
@@ -1094,7 +1138,12 @@ var MarketplaceInstallLocalPlugin = class {
|
|
|
1094
1138
|
mode: "inline",
|
|
1095
1139
|
inserted: result.summary.totalInserted,
|
|
1096
1140
|
updated: result.summary.totalUpdated,
|
|
1097
|
-
errors: result.errors.length
|
|
1141
|
+
errors: result.errors.length,
|
|
1142
|
+
// Surface the first write/resolution failure so the
|
|
1143
|
+
// caller can report WHY nothing landed (e.g. a locked
|
|
1144
|
+
// DB, a missing table, a failed validation) instead of
|
|
1145
|
+
// a bare "0 rows".
|
|
1146
|
+
errorSample: result.errors[0]?.message
|
|
1098
1147
|
};
|
|
1099
1148
|
ctx.logger?.info?.(`[MarketplaceInstallLocal] inline seed for ${appId}${organizationId ? ` (org=${organizationId})` : ""}: inserted=${seedSummary.inserted} updated=${seedSummary.updated} errors=${seedSummary.errors}`);
|
|
1100
1149
|
}
|