@objectstack/runtime 1.0.7 → 1.0.8

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @objectstack/runtime@1.0.7 build /home/runner/work/spec/spec/packages/runtime
2
+ > @objectstack/runtime@1.0.8 build /home/runner/work/spec/spec/packages/runtime
3
3
  > tsup --config ../../tsup.config.ts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -10,13 +10,13 @@
10
10
  CLI Cleaning output folder
11
11
  ESM Build start
12
12
  CJS Build start
13
- ESM dist/index.js 47.89 KB
14
- ESM dist/index.js.map 112.86 KB
15
- ESM ⚡️ Build success in 69ms
16
- CJS dist/index.cjs 49.63 KB
17
- CJS dist/index.cjs.map 112.96 KB
18
- CJS ⚡️ Build success in 75ms
13
+ ESM dist/index.js 49.57 KB
14
+ ESM dist/index.js.map 116.74 KB
15
+ ESM ⚡️ Build success in 147ms
16
+ CJS dist/index.cjs 51.31 KB
17
+ CJS dist/index.cjs.map 116.84 KB
18
+ CJS ⚡️ Build success in 150ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 7169ms
20
+ DTS ⚡️ Build success in 8394ms
21
21
  DTS dist/index.d.ts 17.82 KB
22
22
  DTS dist/index.d.cts 17.82 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @objectstack/runtime
2
2
 
3
+ ## 1.0.8
4
+
5
+ ### Patch Changes
6
+
7
+ - @objectstack/spec@1.0.8
8
+ - @objectstack/core@1.0.8
9
+ - @objectstack/types@1.0.8
10
+
3
11
  ## 1.0.7
4
12
 
5
13
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -800,6 +800,25 @@ var DriverPlugin = class {
800
800
  });
801
801
  };
802
802
  this.start = async (ctx) => {
803
+ if (this.name.startsWith("com.objectstack.driver.")) {
804
+ }
805
+ try {
806
+ const metadata = ctx.getService("metadata");
807
+ if (metadata && metadata.addDatasource) {
808
+ const datasources = metadata.getDatasources ? metadata.getDatasources() : [];
809
+ const hasDefault = datasources.some((ds) => ds.name === "default");
810
+ if (!hasDefault) {
811
+ ctx.logger.info(`[DriverPlugin] No 'default' datasource found. Auto-configuring '${this.driver.name}' as default.`);
812
+ await metadata.addDatasource({
813
+ name: "default",
814
+ driver: this.driver.name
815
+ // The driver's internal name (e.g. com.objectstack.driver.memory)
816
+ });
817
+ }
818
+ }
819
+ } catch (e) {
820
+ ctx.logger.debug("[DriverPlugin] Failed to auto-configure default datasource (Metadata service missing?)", { error: e });
821
+ }
803
822
  ctx.logger.debug("Driver plugin started", { driverName: this.driver.name || "unknown" });
804
823
  };
805
824
  this.driver = driver;
@@ -860,6 +879,23 @@ var AppPlugin = class {
860
879
  } else {
861
880
  ctx.logger.debug("No runtime.onEnable function found", { appId });
862
881
  }
882
+ const manifest = this.bundle.manifest || this.bundle;
883
+ if (manifest && Array.isArray(manifest.data)) {
884
+ ctx.logger.info(`[AppPlugin] Found initial data for ${appId}`, { count: manifest.data.length });
885
+ for (const dataset of manifest.data) {
886
+ if (dataset.object && Array.isArray(dataset.records)) {
887
+ ctx.logger.info(`[Seeder] Seeding ${dataset.records.length} records for ${dataset.object}`);
888
+ for (const record of dataset.records) {
889
+ try {
890
+ await ql.insert(dataset.object, record);
891
+ } catch (err) {
892
+ ctx.logger.warn(`[Seeder] Failed to insert ${dataset.object} record:`, { error: err.message });
893
+ }
894
+ }
895
+ }
896
+ }
897
+ ctx.logger.info("[Seeder] Data seeding complete.");
898
+ }
863
899
  };
864
900
  this.bundle = bundle;
865
901
  const sys = bundle.manifest || bundle;