@liquidmetal-ai/drizzle 0.0.4 → 0.1.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 (56) hide show
  1. package/.changeset/slow-guests-stare.md +7 -0
  2. package/.changeset/tasty-tigers-wash.md +6 -0
  3. package/.turbo/turbo-build.log +1 -1
  4. package/.turbo/turbo-lint.log +1 -1
  5. package/.turbo/turbo-test.log +211 -0
  6. package/dist/appify/build.d.ts +1 -0
  7. package/dist/appify/build.d.ts.map +1 -1
  8. package/dist/appify/build.js +4 -3
  9. package/dist/appify/build.test.js +1 -3
  10. package/dist/appify/index.test.js +2 -2
  11. package/dist/appify/parse.test.js +0 -1
  12. package/dist/appify/validate.d.ts.map +1 -1
  13. package/dist/appify/validate.js +34 -7
  14. package/dist/appify/validate.test.js +119 -26
  15. package/dist/codestore.d.ts +40 -0
  16. package/dist/codestore.d.ts.map +1 -1
  17. package/dist/codestore.js +15 -0
  18. package/dist/liquidmetal/v1alpha1/catalog_connect.d.ts +12 -12
  19. package/dist/liquidmetal/v1alpha1/catalog_connect.d.ts.map +1 -1
  20. package/dist/liquidmetal/v1alpha1/catalog_connect.js +12 -12
  21. package/dist/liquidmetal/v1alpha1/catalog_pb.d.ts +119 -77
  22. package/dist/liquidmetal/v1alpha1/catalog_pb.d.ts.map +1 -1
  23. package/dist/liquidmetal/v1alpha1/catalog_pb.js +177 -107
  24. package/dist/raindrop/index.d.ts +2 -0
  25. package/dist/raindrop/index.d.ts.map +1 -0
  26. package/dist/raindrop/index.js +4 -0
  27. package/dist/raindrop/index.test.d.ts +2 -0
  28. package/dist/raindrop/index.test.d.ts.map +1 -0
  29. package/dist/raindrop/index.test.js +5 -0
  30. package/dist/unsafe/codestore.d.ts +5 -0
  31. package/dist/unsafe/codestore.d.ts.map +1 -1
  32. package/dist/unsafe/codestore.js +5 -1
  33. package/dist/unsafe/framework.d.ts +11 -0
  34. package/dist/unsafe/framework.d.ts.map +1 -0
  35. package/dist/unsafe/framework.js +96 -0
  36. package/dist/unsafe/framework.test.d.ts +2 -0
  37. package/dist/unsafe/framework.test.d.ts.map +1 -0
  38. package/dist/unsafe/framework.test.js +175 -0
  39. package/eslint.config.mjs +1 -2
  40. package/package.json +1 -1
  41. package/src/appify/build.test.ts +1 -3
  42. package/src/appify/build.ts +4 -3
  43. package/src/appify/index.test.ts +2 -2
  44. package/src/appify/parse.test.ts +0 -1
  45. package/src/appify/validate.test.ts +123 -26
  46. package/src/appify/validate.ts +39 -7
  47. package/src/codestore.ts +40 -1
  48. package/src/liquidmetal/v1alpha1/catalog_connect.ts +12 -12
  49. package/src/liquidmetal/v1alpha1/catalog_pb.ts +213 -127
  50. package/src/raindrop/index.test.ts +6 -0
  51. package/src/raindrop/index.ts +4 -0
  52. package/src/unsafe/codestore.ts +7 -3
  53. package/src/unsafe/framework.test.ts +205 -0
  54. package/src/unsafe/framework.ts +113 -0
  55. package/tsconfig.json +3 -9
  56. package/tsconfig.tsbuildinfo +1 -1
@@ -178,6 +178,113 @@ export class ApplicationsResponse_Application extends Message {
178
178
  return proto3.util.equals(ApplicationsResponse_Application, a, b);
179
179
  }
180
180
  }
181
+ /**
182
+ * @generated from message liquidmetal.v1alpha1.BootstrapRequest
183
+ */
184
+ export class BootstrapRequest extends Message {
185
+ /**
186
+ * @generated from field: string user_id = 1;
187
+ */
188
+ userId = "";
189
+ /**
190
+ * @generated from field: string organization_id = 2;
191
+ */
192
+ organizationId = "";
193
+ /**
194
+ * token is a special string interpreted by the catalog service to prove that
195
+ * bootstrapping is desired from a trusted caller.
196
+ *
197
+ * @generated from field: string token = 3;
198
+ */
199
+ token = "";
200
+ /**
201
+ * cloudflare_account_id is cloudflare's account identifier tag.
202
+ * <= 32 characters
203
+ * Example:
204
+ * eb78d65290b24279ba6f44721b3ea3c4
205
+ *
206
+ * @generated from field: string cloudflare_account_id = 4;
207
+ */
208
+ cloudflareAccountId = "";
209
+ /**
210
+ * cloudflare_bearer_token is an API key used with an http header
211
+ * "Authorization: Bearer {cloudflare_bearer_token}".
212
+ *
213
+ * @generated from field: string cloudflare_bearer_token = 5;
214
+ */
215
+ cloudflareBearerToken = "";
216
+ /**
217
+ * liquidmetal_services_domain is a domain allocated for running services like
218
+ * catalog api within the tenant account. The zone managing records for this
219
+ * domain already exists in the provided account specified by
220
+ * cloudflare_account_id.
221
+ *
222
+ * e.g. 01j5980p15smvppgf3zbbw491h.tenant.liquidmetal.run
223
+ *
224
+ * @generated from field: string liquidmetal_services_domain = 6;
225
+ */
226
+ liquidmetalServicesDomain = "";
227
+ /**
228
+ * customer_services_domain is a domain allocated for running
229
+ * customer-deployed applications. The zone managing records for this domain
230
+ * already exists in the provided account specified by cloudflare_account_id.
231
+ * e.g. 01j5980p15smvppgf3zbbw491h.lmapp.run
232
+ *
233
+ * @generated from field: string customer_services_domain = 7;
234
+ */
235
+ customerServicesDomain = "";
236
+ constructor(data) {
237
+ super();
238
+ proto3.util.initPartial(data, this);
239
+ }
240
+ static runtime = proto3;
241
+ static typeName = "liquidmetal.v1alpha1.BootstrapRequest";
242
+ static fields = proto3.util.newFieldList(() => [
243
+ { no: 1, name: "user_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
244
+ { no: 2, name: "organization_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
245
+ { no: 3, name: "token", kind: "scalar", T: 9 /* ScalarType.STRING */ },
246
+ { no: 4, name: "cloudflare_account_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
247
+ { no: 5, name: "cloudflare_bearer_token", kind: "scalar", T: 9 /* ScalarType.STRING */ },
248
+ { no: 6, name: "liquidmetal_services_domain", kind: "scalar", T: 9 /* ScalarType.STRING */ },
249
+ { no: 7, name: "customer_services_domain", kind: "scalar", T: 9 /* ScalarType.STRING */ },
250
+ ]);
251
+ static fromBinary(bytes, options) {
252
+ return new BootstrapRequest().fromBinary(bytes, options);
253
+ }
254
+ static fromJson(jsonValue, options) {
255
+ return new BootstrapRequest().fromJson(jsonValue, options);
256
+ }
257
+ static fromJsonString(jsonString, options) {
258
+ return new BootstrapRequest().fromJsonString(jsonString, options);
259
+ }
260
+ static equals(a, b) {
261
+ return proto3.util.equals(BootstrapRequest, a, b);
262
+ }
263
+ }
264
+ /**
265
+ * @generated from message liquidmetal.v1alpha1.BootstrapResponse
266
+ */
267
+ export class BootstrapResponse extends Message {
268
+ constructor(data) {
269
+ super();
270
+ proto3.util.initPartial(data, this);
271
+ }
272
+ static runtime = proto3;
273
+ static typeName = "liquidmetal.v1alpha1.BootstrapResponse";
274
+ static fields = proto3.util.newFieldList(() => []);
275
+ static fromBinary(bytes, options) {
276
+ return new BootstrapResponse().fromBinary(bytes, options);
277
+ }
278
+ static fromJson(jsonValue, options) {
279
+ return new BootstrapResponse().fromJson(jsonValue, options);
280
+ }
281
+ static fromJsonString(jsonString, options) {
282
+ return new BootstrapResponse().fromJsonString(jsonString, options);
283
+ }
284
+ static equals(a, b) {
285
+ return proto3.util.equals(BootstrapResponse, a, b);
286
+ }
287
+ }
181
288
  /**
182
289
  * InternalApplicationsRequestPaginationToken is what we serialize into an
183
290
  * opaque string that is interpreted within internal backend systems
@@ -253,6 +360,36 @@ export class CreateApplicationsRequest extends Message {
253
360
  return proto3.util.equals(CreateApplicationsRequest, a, b);
254
361
  }
255
362
  }
363
+ /**
364
+ * @generated from message liquidmetal.v1alpha1.CreateApplicationsRequest.ApplicationMetadata
365
+ */
366
+ export class CreateApplicationsRequest_ApplicationMetadata extends Message {
367
+ /**
368
+ * @generated from field: string runtime_version = 1;
369
+ */
370
+ runtimeVersion = "";
371
+ constructor(data) {
372
+ super();
373
+ proto3.util.initPartial(data, this);
374
+ }
375
+ static runtime = proto3;
376
+ static typeName = "liquidmetal.v1alpha1.CreateApplicationsRequest.ApplicationMetadata";
377
+ static fields = proto3.util.newFieldList(() => [
378
+ { no: 1, name: "runtime_version", kind: "scalar", T: 9 /* ScalarType.STRING */ },
379
+ ]);
380
+ static fromBinary(bytes, options) {
381
+ return new CreateApplicationsRequest_ApplicationMetadata().fromBinary(bytes, options);
382
+ }
383
+ static fromJson(jsonValue, options) {
384
+ return new CreateApplicationsRequest_ApplicationMetadata().fromJson(jsonValue, options);
385
+ }
386
+ static fromJsonString(jsonString, options) {
387
+ return new CreateApplicationsRequest_ApplicationMetadata().fromJsonString(jsonString, options);
388
+ }
389
+ static equals(a, b) {
390
+ return proto3.util.equals(CreateApplicationsRequest_ApplicationMetadata, a, b);
391
+ }
392
+ }
256
393
  /**
257
394
  * @generated from message liquidmetal.v1alpha1.CreateApplicationsRequest.Application
258
395
  */
@@ -277,6 +414,10 @@ export class CreateApplicationsRequest_Application extends Message {
277
414
  * @generated from field: bool is_active = 6;
278
415
  */
279
416
  isActive = false;
417
+ /**
418
+ * @generated from field: liquidmetal.v1alpha1.CreateApplicationsRequest.ApplicationMetadata metadata = 7;
419
+ */
420
+ metadata;
280
421
  constructor(data) {
281
422
  super();
282
423
  proto3.util.initPartial(data, this);
@@ -290,6 +431,7 @@ export class CreateApplicationsRequest_Application extends Message {
290
431
  { no: 4, name: "manifest", kind: "scalar", T: 9 /* ScalarType.STRING */ },
291
432
  { no: 5, name: "manifest_json", kind: "scalar", T: 9 /* ScalarType.STRING */ },
292
433
  { no: 6, name: "is_active", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
434
+ { no: 7, name: "metadata", kind: "message", T: CreateApplicationsRequest_ApplicationMetadata },
293
435
  ]);
294
436
  static fromBinary(bytes, options) {
295
437
  return new CreateApplicationsRequest_Application().fromBinary(bytes, options);
@@ -1092,113 +1234,6 @@ export class GetEnvResponse extends Message {
1092
1234
  return proto3.util.equals(GetEnvResponse, a, b);
1093
1235
  }
1094
1236
  }
1095
- /**
1096
- * @generated from message liquidmetal.v1alpha1.BootstrapRequest
1097
- */
1098
- export class BootstrapRequest extends Message {
1099
- /**
1100
- * @generated from field: string user_id = 1;
1101
- */
1102
- userId = "";
1103
- /**
1104
- * @generated from field: string organization_id = 2;
1105
- */
1106
- organizationId = "";
1107
- /**
1108
- * token is a special string interpreted by the catalog service to prove that
1109
- * bootstrapping is desired from a trusted caller.
1110
- *
1111
- * @generated from field: string token = 3;
1112
- */
1113
- token = "";
1114
- /**
1115
- * cloudflare_account_id is cloudflare's account identifier tag.
1116
- * <= 32 characters
1117
- * Example:
1118
- * eb78d65290b24279ba6f44721b3ea3c4
1119
- *
1120
- * @generated from field: string cloudflare_account_id = 4;
1121
- */
1122
- cloudflareAccountId = "";
1123
- /**
1124
- * cloudflare_bearer_token is an API key used with an http header
1125
- * "Authorization: Bearer {cloudflare_bearer_token}".
1126
- *
1127
- * @generated from field: string cloudflare_bearer_token = 5;
1128
- */
1129
- cloudflareBearerToken = "";
1130
- /**
1131
- * liquidmetal_services_domain is a domain allocated for running services like
1132
- * catalog api within the tenant account. The zone managing records for this
1133
- * domain already exists in the provided account specified by
1134
- * cloudflare_account_id.
1135
- *
1136
- * e.g. 01j5980p15smvppgf3zbbw491h.tenant.liquidmetal.run
1137
- *
1138
- * @generated from field: string liquidmetal_services_domain = 6;
1139
- */
1140
- liquidmetalServicesDomain = "";
1141
- /**
1142
- * customer_services_domain is a domain allocated for running
1143
- * customer-deployed applications. The zone managing records for this domain
1144
- * already exists in the provided account specified by cloudflare_account_id.
1145
- * e.g. 01j5980p15smvppgf3zbbw491h.lmapp.run
1146
- *
1147
- * @generated from field: string customer_services_domain = 7;
1148
- */
1149
- customerServicesDomain = "";
1150
- constructor(data) {
1151
- super();
1152
- proto3.util.initPartial(data, this);
1153
- }
1154
- static runtime = proto3;
1155
- static typeName = "liquidmetal.v1alpha1.BootstrapRequest";
1156
- static fields = proto3.util.newFieldList(() => [
1157
- { no: 1, name: "user_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
1158
- { no: 2, name: "organization_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
1159
- { no: 3, name: "token", kind: "scalar", T: 9 /* ScalarType.STRING */ },
1160
- { no: 4, name: "cloudflare_account_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
1161
- { no: 5, name: "cloudflare_bearer_token", kind: "scalar", T: 9 /* ScalarType.STRING */ },
1162
- { no: 6, name: "liquidmetal_services_domain", kind: "scalar", T: 9 /* ScalarType.STRING */ },
1163
- { no: 7, name: "customer_services_domain", kind: "scalar", T: 9 /* ScalarType.STRING */ },
1164
- ]);
1165
- static fromBinary(bytes, options) {
1166
- return new BootstrapRequest().fromBinary(bytes, options);
1167
- }
1168
- static fromJson(jsonValue, options) {
1169
- return new BootstrapRequest().fromJson(jsonValue, options);
1170
- }
1171
- static fromJsonString(jsonString, options) {
1172
- return new BootstrapRequest().fromJsonString(jsonString, options);
1173
- }
1174
- static equals(a, b) {
1175
- return proto3.util.equals(BootstrapRequest, a, b);
1176
- }
1177
- }
1178
- /**
1179
- * @generated from message liquidmetal.v1alpha1.BootstrapResponse
1180
- */
1181
- export class BootstrapResponse extends Message {
1182
- constructor(data) {
1183
- super();
1184
- proto3.util.initPartial(data, this);
1185
- }
1186
- static runtime = proto3;
1187
- static typeName = "liquidmetal.v1alpha1.BootstrapResponse";
1188
- static fields = proto3.util.newFieldList(() => []);
1189
- static fromBinary(bytes, options) {
1190
- return new BootstrapResponse().fromBinary(bytes, options);
1191
- }
1192
- static fromJson(jsonValue, options) {
1193
- return new BootstrapResponse().fromJson(jsonValue, options);
1194
- }
1195
- static fromJsonString(jsonString, options) {
1196
- return new BootstrapResponse().fromJsonString(jsonString, options);
1197
- }
1198
- static equals(a, b) {
1199
- return proto3.util.equals(BootstrapResponse, a, b);
1200
- }
1201
- }
1202
1237
  /**
1203
1238
  * @generated from message liquidmetal.v1alpha1.SetApplicationActiveStatesRequest
1204
1239
  */
@@ -1389,6 +1424,36 @@ export class SetApplicationManifestsRequest extends Message {
1389
1424
  return proto3.util.equals(SetApplicationManifestsRequest, a, b);
1390
1425
  }
1391
1426
  }
1427
+ /**
1428
+ * @generated from message liquidmetal.v1alpha1.SetApplicationManifestsRequest.ApplicationMetadata
1429
+ */
1430
+ export class SetApplicationManifestsRequest_ApplicationMetadata extends Message {
1431
+ /**
1432
+ * @generated from field: string runtime_version = 1;
1433
+ */
1434
+ runtimeVersion = "";
1435
+ constructor(data) {
1436
+ super();
1437
+ proto3.util.initPartial(data, this);
1438
+ }
1439
+ static runtime = proto3;
1440
+ static typeName = "liquidmetal.v1alpha1.SetApplicationManifestsRequest.ApplicationMetadata";
1441
+ static fields = proto3.util.newFieldList(() => [
1442
+ { no: 1, name: "runtime_version", kind: "scalar", T: 9 /* ScalarType.STRING */ },
1443
+ ]);
1444
+ static fromBinary(bytes, options) {
1445
+ return new SetApplicationManifestsRequest_ApplicationMetadata().fromBinary(bytes, options);
1446
+ }
1447
+ static fromJson(jsonValue, options) {
1448
+ return new SetApplicationManifestsRequest_ApplicationMetadata().fromJson(jsonValue, options);
1449
+ }
1450
+ static fromJsonString(jsonString, options) {
1451
+ return new SetApplicationManifestsRequest_ApplicationMetadata().fromJsonString(jsonString, options);
1452
+ }
1453
+ static equals(a, b) {
1454
+ return proto3.util.equals(SetApplicationManifestsRequest_ApplicationMetadata, a, b);
1455
+ }
1456
+ }
1392
1457
  /**
1393
1458
  * @generated from message liquidmetal.v1alpha1.SetApplicationManifestsRequest.Manifest
1394
1459
  */
@@ -1405,6 +1470,10 @@ export class SetApplicationManifestsRequest_Manifest extends Message {
1405
1470
  * @generated from field: string manifest = 3;
1406
1471
  */
1407
1472
  manifest = "";
1473
+ /**
1474
+ * @generated from field: liquidmetal.v1alpha1.SetApplicationManifestsRequest.ApplicationMetadata metadata = 4;
1475
+ */
1476
+ metadata;
1408
1477
  constructor(data) {
1409
1478
  super();
1410
1479
  proto3.util.initPartial(data, this);
@@ -1415,6 +1484,7 @@ export class SetApplicationManifestsRequest_Manifest extends Message {
1415
1484
  { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
1416
1485
  { no: 2, name: "version_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
1417
1486
  { no: 3, name: "manifest", kind: "scalar", T: 9 /* ScalarType.STRING */ },
1487
+ { no: 4, name: "metadata", kind: "message", T: SetApplicationManifestsRequest_ApplicationMetadata },
1418
1488
  ]);
1419
1489
  static fromBinary(bytes, options) {
1420
1490
  return new SetApplicationManifestsRequest_Manifest().fromBinary(bytes, options);
@@ -0,0 +1,2 @@
1
+ export declare function urlifyOrganizationId(organizationId: string): string;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/raindrop/index.ts"],"names":[],"mappings":"AACA,wBAAgB,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAEnE"}
@@ -0,0 +1,4 @@
1
+ // urlifyOrganizationId converts an organizationId for usage in URLs
2
+ export function urlifyOrganizationId(organizationId) {
3
+ return organizationId.replace('org_', '').toLowerCase();
4
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/raindrop/index.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { expect, test } from 'vitest';
2
+ import { urlifyOrganizationId } from './index.js';
3
+ test('urlifyOrganizationId', async () => {
4
+ expect(urlifyOrganizationId('org_01J99WVZ3PKE5W1CHW5H3HD8EN')).toBe('01j99wvz3pke5w1chw5h3hd8en');
5
+ });
@@ -1,4 +1,9 @@
1
1
  import { Bundle, BundleBase } from '../codestore.js';
2
+ /**
3
+ * A Bundle implementation backed by the local filesystem
4
+ * Provides direct access to files and directories on disk
5
+ * Note: This implementation is marked as "unsafe" since it requires filesystem access
6
+ */
2
7
  export declare class FileSystemBundle extends BundleBase implements Bundle {
3
8
  private root;
4
9
  constructor(root: string);
@@ -1 +1 @@
1
- {"version":3,"file":"codestore.d.ts","sourceRoot":"","sources":["../../src/unsafe/codestore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGrD,qBAAa,gBAAiB,SAAQ,UAAW,YAAW,MAAM;IAChE,OAAO,CAAC,IAAI,CAAS;gBAET,IAAI,EAAE,MAAM;IAKlB,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAezB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAInC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAInD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG1C"}
1
+ {"version":3,"file":"codestore.d.ts","sourceRoot":"","sources":["../../src/unsafe/codestore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,UAAW,YAAW,MAAM;IAChE,OAAO,CAAC,IAAI,CAAS;gBAET,IAAI,EAAE,MAAM;IAKlB,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAezB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAInC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAInD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG1C"}
@@ -1,7 +1,11 @@
1
1
  import * as fs from 'node:fs/promises';
2
2
  import * as path from 'node:path';
3
3
  import { BundleBase } from '../codestore.js';
4
- // FileSystemBundle is a Bundle backed by the file system.
4
+ /**
5
+ * A Bundle implementation backed by the local filesystem
6
+ * Provides direct access to files and directories on disk
7
+ * Note: This implementation is marked as "unsafe" since it requires filesystem access
8
+ */
5
9
  export class FileSystemBundle extends BundleBase {
6
10
  root;
7
11
  constructor(root) {
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The name of the framework package
3
+ */
4
+ export declare const FRAMEWORK_PACKAGE = "@liquidmetal-ai/raindrop-framework";
5
+ /**
6
+ * Get the version of a package in the current project
7
+ * @param packageName The name of the package to find
8
+ * @returns The version of the package, or null if not found
9
+ */
10
+ export declare function getPackageVersion(packageName: string): Promise<string | null>;
11
+ //# sourceMappingURL=framework.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework.d.ts","sourceRoot":"","sources":["../../src/unsafe/framework.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,iBAAiB,uCAAuC,CAAC;AAiFtE;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAkBnF"}
@@ -0,0 +1,96 @@
1
+ import { exec } from 'node:child_process';
2
+ import { lstat } from 'node:fs/promises';
3
+ import { dirname, join, parse } from 'node:path';
4
+ import { promisify } from 'node:util';
5
+ /**
6
+ * The name of the framework package
7
+ */
8
+ export const FRAMEWORK_PACKAGE = '@liquidmetal-ai/raindrop-framework';
9
+ const execAsync = promisify(exec);
10
+ function findDependencyVersion(deps, packageName) {
11
+ if (!deps)
12
+ return null;
13
+ if (deps[packageName]) {
14
+ return deps[packageName].version;
15
+ }
16
+ for (const dep of Object.values(deps)) {
17
+ if (dep.dependencies) {
18
+ const version = findDependencyVersion(dep.dependencies, packageName);
19
+ if (version)
20
+ return version;
21
+ }
22
+ }
23
+ return null;
24
+ }
25
+ async function fileExists(path) {
26
+ try {
27
+ await lstat(path);
28
+ return true;
29
+ }
30
+ catch {
31
+ return false;
32
+ }
33
+ }
34
+ async function detectPackageManager(dir) {
35
+ if (await fileExists(join(dir, 'package-lock.json')))
36
+ return 'npm';
37
+ if (await fileExists(join(dir, 'yarn.lock')))
38
+ return 'yarn';
39
+ if (await fileExists(join(dir, 'pnpm-lock.yaml')))
40
+ return 'pnpm';
41
+ return null;
42
+ }
43
+ const getVersionFromCommand = async (packageName, packageManager) => {
44
+ try {
45
+ const command = {
46
+ npm: `npm list ${packageName} --json`,
47
+ yarn: `yarn list --pattern "${packageName}" --json`,
48
+ pnpm: `pnpm list ${packageName} --json`,
49
+ }[packageManager];
50
+ const { stdout } = await execAsync(command);
51
+ if (packageManager === 'yarn') {
52
+ const lines = stdout.split('\n').filter((line) => line.trim());
53
+ for (const line of lines) {
54
+ const parsed = JSON.parse(line);
55
+ if (parsed.data?.trees) {
56
+ const match = parsed.data.trees.find((t) => t.name === packageName);
57
+ if (match)
58
+ return match.version;
59
+ }
60
+ }
61
+ }
62
+ else {
63
+ const data = JSON.parse(stdout);
64
+ return findDependencyVersion(data.dependencies, packageName);
65
+ }
66
+ }
67
+ catch (error) {
68
+ console.error(`Error executing ${packageManager} list command:`, error);
69
+ return null;
70
+ }
71
+ return null;
72
+ };
73
+ /**
74
+ * Get the version of a package in the current project
75
+ * @param packageName The name of the package to find
76
+ * @returns The version of the package, or null if not found
77
+ */
78
+ export async function getPackageVersion(packageName) {
79
+ try {
80
+ let currentDir = process.cwd();
81
+ while (currentDir !== parse(currentDir).root) {
82
+ const packageManager = await detectPackageManager(currentDir);
83
+ if (packageManager) {
84
+ const version = await getVersionFromCommand(packageName, packageManager);
85
+ if (version)
86
+ return version;
87
+ }
88
+ currentDir = dirname(currentDir);
89
+ }
90
+ throw new Error('Package version not found');
91
+ }
92
+ catch (error) {
93
+ console.error(`Error reading package version:`, error);
94
+ return null;
95
+ }
96
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=framework.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework.test.d.ts","sourceRoot":"","sources":["../../src/unsafe/framework.test.ts"],"names":[],"mappings":""}