@liquidmetal-ai/drizzle 0.1.3 → 0.2.2

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 (44) hide show
  1. package/.changeset/breezy-lamps-fry.md +6 -0
  2. package/.turbo/turbo-lint.log +6 -0
  3. package/.turbo/turbo-test.log +6 -0
  4. package/dist/appify/build.d.ts +32 -2
  5. package/dist/appify/build.d.ts.map +1 -1
  6. package/dist/appify/build.js +166 -24
  7. package/dist/appify/build.test.js +75 -3
  8. package/dist/appify/validate.d.ts +2 -1
  9. package/dist/appify/validate.d.ts.map +1 -1
  10. package/dist/appify/validate.js +71 -2
  11. package/dist/appify/validate.test.js +74 -4
  12. package/dist/codestore.js +2 -2
  13. package/dist/liquidmetal/v1alpha1/catalog_connect.d.ts +81 -78
  14. package/dist/liquidmetal/v1alpha1/catalog_connect.d.ts.map +1 -1
  15. package/dist/liquidmetal/v1alpha1/catalog_connect.js +81 -78
  16. package/dist/liquidmetal/v1alpha1/catalog_pb.d.ts +572 -610
  17. package/dist/liquidmetal/v1alpha1/catalog_pb.d.ts.map +1 -1
  18. package/dist/liquidmetal/v1alpha1/catalog_pb.js +675 -741
  19. package/dist/liquidmetal/v1alpha1/resource_interface_connect.d.ts +68 -0
  20. package/dist/liquidmetal/v1alpha1/resource_interface_connect.d.ts.map +1 -0
  21. package/dist/liquidmetal/v1alpha1/resource_interface_connect.js +73 -0
  22. package/dist/liquidmetal/v1alpha1/resource_interface_pb.d.ts +283 -0
  23. package/dist/liquidmetal/v1alpha1/resource_interface_pb.d.ts.map +1 -0
  24. package/dist/liquidmetal/v1alpha1/resource_interface_pb.js +454 -0
  25. package/dist/liquidmetal/v1alpha1/search_agent_connect.d.ts +170 -0
  26. package/dist/liquidmetal/v1alpha1/search_agent_connect.d.ts.map +1 -0
  27. package/dist/liquidmetal/v1alpha1/search_agent_connect.js +173 -0
  28. package/dist/liquidmetal/v1alpha1/search_agent_pb.d.ts +505 -0
  29. package/dist/liquidmetal/v1alpha1/search_agent_pb.d.ts.map +1 -0
  30. package/dist/liquidmetal/v1alpha1/search_agent_pb.js +715 -0
  31. package/package.json +1 -1
  32. package/src/appify/build.test.ts +85 -3
  33. package/src/appify/build.ts +181 -25
  34. package/src/appify/validate.test.ts +77 -4
  35. package/src/appify/validate.ts +78 -1
  36. package/src/codestore.ts +2 -2
  37. package/src/liquidmetal/v1alpha1/catalog_connect.ts +81 -78
  38. package/src/liquidmetal/v1alpha1/catalog_pb.ts +872 -970
  39. package/src/liquidmetal/v1alpha1/resource_interface_connect.ts +77 -0
  40. package/src/liquidmetal/v1alpha1/resource_interface_pb.ts +561 -0
  41. package/src/liquidmetal/v1alpha1/search_agent_connect.ts +176 -0
  42. package/src/liquidmetal/v1alpha1/search_agent_pb.ts +842 -0
  43. package/tsconfig.tsbuildinfo +1 -1
  44. package/.turbo/turbo-build.log +0 -30
@@ -10,6 +10,9 @@ import {
10
10
  Queue,
11
11
  Service,
12
12
  SqlDatabase,
13
+ Task,
14
+ TASK_TYPES,
15
+ TaskType,
13
16
  valueOf,
14
17
  VectorIndex,
15
18
  VISIBILITIES,
@@ -32,6 +35,7 @@ export type Validator = {
32
35
  onService?: On<Service>;
33
36
  onActor?: On<Actor>;
34
37
  onObserver?: On<Observer>;
38
+ onTask?: On<Task>;
35
39
  onBucket?: On<Bucket>;
36
40
  onQueue?: On<Queue>;
37
41
  onEnv?: On<Env>;
@@ -61,6 +65,7 @@ export async function validate(apps: Application[], validators: Validator[]): Pr
61
65
  await validateServices(app, validator, errors);
62
66
  await validateActors(app, validator, errors);
63
67
  await validateObservers(app, validator, errors);
68
+ await validateTasks(app, validator, errors);
64
69
  await validateBuckets(app, validator, errors);
65
70
  await validateQueues(app, validator, errors);
66
71
  await validateEnvs(app, app, validator, errors);
@@ -96,6 +101,14 @@ async function validateObservers(app: Application, validator: Validator, errors:
96
101
  }
97
102
  }
98
103
 
104
+ async function validateTasks(app: Application, validator: Validator, errors: ValidationError[]): Promise<void> {
105
+ for (const task of app.task) {
106
+ await validateHelper(validator.onTask, app, task, errors);
107
+ await validateBindings(app, task, validator, errors);
108
+ await validateEnvs(app, task, validator, errors);
109
+ }
110
+ }
111
+
99
112
  async function validateBuckets(app: Application, validator: Validator, errors: ValidationError[]): Promise<void> {
100
113
  for (const bucket of app.bucket) {
101
114
  await validateHelper(validator.onBucket, app, bucket, errors);
@@ -338,6 +351,47 @@ const observerSourceValidator: Validator = {
338
351
  },
339
352
  };
340
353
 
354
+ const taskValidator: Validator = {
355
+ onTask: async (app: Application, task: Task): Promise<ValidationError[]> => {
356
+ const errors: ValidationError[] = [];
357
+ if (task.type === undefined) {
358
+ errors.push({
359
+ message: 'task must have a type',
360
+ severity: 'error',
361
+ ...task.obj,
362
+ });
363
+ return errors;
364
+ }
365
+ if (TASK_TYPES.indexOf(valueOf(task.type) as TaskType) === -1) {
366
+ errors.push({
367
+ message: `task type must be one of: ${TASK_TYPES.join(', ')}`,
368
+ severity: 'error',
369
+ ...task.obj,
370
+ });
371
+ return errors;
372
+ }
373
+ if (valueOf(task.type) === 'cron') {
374
+ if (task.cron === undefined) {
375
+ errors.push({
376
+ message: 'cron task must have a cron attribute',
377
+ severity: 'error',
378
+ ...task.obj,
379
+ });
380
+ } else if (!VALID_CRON_PATTERN.test(valueOf(task.cron))) {
381
+ errors.push({
382
+ message: `task cron expression is malformed: ${valueOf(task.cron)}`,
383
+ severity: 'error',
384
+ ...task.obj,
385
+ });
386
+ }
387
+ }
388
+ return errors;
389
+ },
390
+ };
391
+
392
+ const VALID_CRON_PATTERN =
393
+ /(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every (\d+(ns|us|µs|ms|s|m|h))+)|((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*) ?){5,7})/;
394
+
341
395
  async function visibilityValidatorFn(app: Application, obj: { visibility?: TokenString }): Promise<ValidationError[]> {
342
396
  const errors: ValidationError[] = [];
343
397
  if (obj.visibility && !(VISIBILITIES as readonly string[]).includes(valueOf(obj.visibility))) {
@@ -353,6 +407,7 @@ async function visibilityValidatorFn(app: Application, obj: { visibility?: Token
353
407
  const visibilityValidator: Validator = {
354
408
  onService: visibilityValidatorFn,
355
409
  onActor: visibilityValidatorFn,
410
+ onTask: visibilityValidatorFn,
356
411
  onQueue: visibilityValidatorFn,
357
412
  onBucket: visibilityValidatorFn,
358
413
  };
@@ -397,7 +452,7 @@ const vectorIndexValidator: Validator = {
397
452
  const errors: ValidationError[] = [];
398
453
  if (vectorIndex.dimensions === undefined) {
399
454
  errors.push({
400
- message: 'vector index must have a dimension',
455
+ message: 'vector index must have a dimensions',
401
456
  severity: 'error',
402
457
  ...vectorIndex.obj,
403
458
  });
@@ -466,14 +521,36 @@ const duplicateModuleValidator: Validator = {
466
521
  },
467
522
  };
468
523
 
524
+ const locationHintValidator: Validator = {
525
+ onBucket: async (app: Application, bucket: Bucket): Promise<ValidationError[]> => {
526
+ const locations = ['wnam', 'enam', 'weur', 'eeur', 'apac', 'oc'];
527
+ const errors: ValidationError[] = [];
528
+ // Default value is enam.
529
+ if (bucket.locationHint === undefined) {
530
+ return errors;
531
+ }
532
+ // Check if the value is valid.
533
+ if (!locations.includes(valueOf(bucket.locationHint))) {
534
+ errors.push({
535
+ message: `location_hint must be one of ${locations.join(', ')}`,
536
+ severity: 'error',
537
+ ...bucket.locationHint,
538
+ });
539
+ }
540
+ return errors;
541
+ },
542
+ };
543
+
469
544
  export const VALIDATORS: Validator[] = [
470
545
  bindingNameValidator,
471
546
  bindingValueValidator,
472
547
  domainValidator,
473
548
  envValidator,
474
549
  observerSourceValidator,
550
+ taskValidator,
475
551
  visibilityValidator,
476
552
  nameValidator,
477
553
  vectorIndexValidator,
478
554
  duplicateModuleValidator,
555
+ locationHintValidator,
479
556
  ];
package/src/codestore.ts CHANGED
@@ -112,7 +112,7 @@ export async function archive(bundle: ReadableBundle): Promise<ArrayBuffer> {
112
112
  for await (const file of bundle) {
113
113
  zip.file(file.name, await file.read());
114
114
  }
115
- return await zip.generateAsync({ type: 'arraybuffer' });
115
+ return await zip.generateAsync({ type: 'uint8array' });
116
116
  }
117
117
 
118
118
  /**
@@ -126,7 +126,7 @@ export async function unarchive(zipBuffer: ArrayBuffer, bundle: WritableBundle):
126
126
  if (file.dir) {
127
127
  continue;
128
128
  }
129
- const content = await file.async('arraybuffer');
129
+ const content = await file.async('uint8array');
130
130
  await bundle.write(file.name, Buffer.from(content));
131
131
  }
132
132
  }
@@ -3,7 +3,7 @@
3
3
  /* eslint-disable */
4
4
  // @ts-nocheck
5
5
 
6
- import { ApplicationsRequest, ApplicationsResponse, BootstrapRequest, BootstrapResponse, CreateApplicationsRequest, CreateApplicationsResponse, CreateVersionRequest, CreateVersionResponse, DeleteApplicationsRequest, DeleteApplicationsResponse, GetEnvRequest, GetEnvResponse, QueryResourcesRequest, QueryResourcesResponse, SetApplicationActiveStatesRequest, SetApplicationActiveStatesResponse, SetApplicationManifestsRequest, SetApplicationManifestsResponse, SetEnvRequest, SetEnvResponse, SetVersionSandboxStatesRequest, SetVersionSandboxStatesResponse, StatBundleRequest, StatBundleResponse, UploadBundleRequest, UploadBundleResponse, VersionsRequest, VersionsResponse } from "./catalog_pb.js";
6
+ import { ApplicationsRequest, ApplicationsResponse, BootstrapRequest, BootstrapResponse, DeleteRequest, DeleteResponse, DeployRequest, DeployResponse, GetEnvsRequest, GetEnvsResponse, QueryResourcesRequest, QueryResourcesResponse, ReleaseRequest, ReleaseResponse, SetActiveRequest, SetActiveResponse, SetEnvsRequest, SetEnvsResponse, SetSandboxRequest, SetSandboxResponse, StatusRequest, StatusResponse, UploadBundleRequest, UploadBundleResponse, WatchRequest, WatchResponse } from "./catalog_pb.js";
7
7
  import { MethodKind } from "@bufbuild/protobuf";
8
8
 
9
9
  /**
@@ -23,6 +23,17 @@ import { MethodKind } from "@bufbuild/protobuf";
23
23
  export const CatalogService = {
24
24
  typeName: "liquidmetal.v1alpha1.CatalogService",
25
25
  methods: {
26
+ /**
27
+ * QueryResources returns the physical underlying resources for a given query
28
+ *
29
+ * @generated from rpc liquidmetal.v1alpha1.CatalogService.QueryResources
30
+ */
31
+ queryResources: {
32
+ name: "QueryResources",
33
+ I: QueryResourcesRequest,
34
+ O: QueryResourcesResponse,
35
+ kind: MethodKind.Unary,
36
+ },
26
37
  /**
27
38
  * Bootstrap is a special RPC that is used to bootstrap the system
28
39
  * using a one-time token.
@@ -35,33 +46,6 @@ export const CatalogService = {
35
46
  O: BootstrapResponse,
36
47
  kind: MethodKind.Unary,
37
48
  },
38
- /**
39
- * @generated from rpc liquidmetal.v1alpha1.CatalogService.Versions
40
- */
41
- versions: {
42
- name: "Versions",
43
- I: VersionsRequest,
44
- O: VersionsResponse,
45
- kind: MethodKind.Unary,
46
- },
47
- /**
48
- * @generated from rpc liquidmetal.v1alpha1.CatalogService.CreateVersion
49
- */
50
- createVersion: {
51
- name: "CreateVersion",
52
- I: CreateVersionRequest,
53
- O: CreateVersionResponse,
54
- kind: MethodKind.Unary,
55
- },
56
- /**
57
- * @generated from rpc liquidmetal.v1alpha1.CatalogService.SetVersionSandboxStates
58
- */
59
- setVersionSandboxStates: {
60
- name: "SetVersionSandboxStates",
61
- I: SetVersionSandboxStatesRequest,
62
- O: SetVersionSandboxStatesResponse,
63
- kind: MethodKind.Unary,
64
- },
65
49
  /**
66
50
  * Applications fetches a list of applications for an organization.
67
51
  * This list follows best practices for pagination.
@@ -76,94 +60,113 @@ export const CatalogService = {
76
60
  kind: MethodKind.Unary,
77
61
  },
78
62
  /**
79
- * @generated from rpc liquidmetal.v1alpha1.CatalogService.CreateApplications
63
+ * Deploy creates a new version, or branch, or amends in place.
64
+ *
65
+ * @generated from rpc liquidmetal.v1alpha1.CatalogService.Deploy
80
66
  */
81
- createApplications: {
82
- name: "CreateApplications",
83
- I: CreateApplicationsRequest,
84
- O: CreateApplicationsResponse,
67
+ deploy: {
68
+ name: "Deploy",
69
+ I: DeployRequest,
70
+ O: DeployResponse,
85
71
  kind: MethodKind.Unary,
86
72
  },
87
73
  /**
88
- * @generated from rpc liquidmetal.v1alpha1.CatalogService.SetApplicationActiveStates
74
+ * UploadBundle uploads a bundle for a specific application version.
75
+ *
76
+ * @generated from rpc liquidmetal.v1alpha1.CatalogService.UploadBundle
89
77
  */
90
- setApplicationActiveStates: {
91
- name: "SetApplicationActiveStates",
92
- I: SetApplicationActiveStatesRequest,
93
- O: SetApplicationActiveStatesResponse,
78
+ uploadBundle: {
79
+ name: "UploadBundle",
80
+ I: UploadBundleRequest,
81
+ O: UploadBundleResponse,
94
82
  kind: MethodKind.Unary,
95
83
  },
96
84
  /**
97
- * @generated from rpc liquidmetal.v1alpha1.CatalogService.DeleteApplications
85
+ * SetEnvs sets multiple environment variables for an application/version.
86
+ *
87
+ * @generated from rpc liquidmetal.v1alpha1.CatalogService.SetEnvs
98
88
  */
99
- deleteApplications: {
100
- name: "DeleteApplications",
101
- I: DeleteApplicationsRequest,
102
- O: DeleteApplicationsResponse,
89
+ setEnvs: {
90
+ name: "SetEnvs",
91
+ I: SetEnvsRequest,
92
+ O: SetEnvsResponse,
103
93
  kind: MethodKind.Unary,
104
94
  },
105
95
  /**
106
- * @generated from rpc liquidmetal.v1alpha1.CatalogService.SetApplicationManifests
96
+ * GetEnvs gets multiple environment variables for an application/version.
97
+ *
98
+ * @generated from rpc liquidmetal.v1alpha1.CatalogService.GetEnvs
107
99
  */
108
- setApplicationManifests: {
109
- name: "SetApplicationManifests",
110
- I: SetApplicationManifestsRequest,
111
- O: SetApplicationManifestsResponse,
100
+ getEnvs: {
101
+ name: "GetEnvs",
102
+ I: GetEnvsRequest,
103
+ O: GetEnvsResponse,
112
104
  kind: MethodKind.Unary,
113
105
  },
114
106
  /**
115
- * UploadBundle uploads a bundle for a specific application version.
107
+ * Release allows a deployed application to converge.
116
108
  *
117
- * @generated from rpc liquidmetal.v1alpha1.CatalogService.UploadBundle
109
+ * @generated from rpc liquidmetal.v1alpha1.CatalogService.Release
118
110
  */
119
- uploadBundle: {
120
- name: "UploadBundle",
121
- I: UploadBundleRequest,
122
- O: UploadBundleResponse,
111
+ release: {
112
+ name: "Release",
113
+ I: ReleaseRequest,
114
+ O: ReleaseResponse,
123
115
  kind: MethodKind.Unary,
124
116
  },
125
117
  /**
126
- * StatBundle returns the metadata for a bundle.
118
+ * Watch attaches a watcher to the ring buffer associated with an application.
119
+ *
120
+ * @generated from rpc liquidmetal.v1alpha1.CatalogService.Watch
121
+ */
122
+ watch: {
123
+ name: "Watch",
124
+ I: WatchRequest,
125
+ O: WatchResponse,
126
+ kind: MethodKind.ServerStreaming,
127
+ },
128
+ /**
129
+ * Delete sets an application to deleting.
127
130
  *
128
- * @generated from rpc liquidmetal.v1alpha1.CatalogService.StatBundle
131
+ * @generated from rpc liquidmetal.v1alpha1.CatalogService.Delete
129
132
  */
130
- statBundle: {
131
- name: "StatBundle",
132
- I: StatBundleRequest,
133
- O: StatBundleResponse,
133
+ delete: {
134
+ name: "Delete",
135
+ I: DeleteRequest,
136
+ O: DeleteResponse,
134
137
  kind: MethodKind.Unary,
135
138
  },
136
139
  /**
137
- * SetEnv sets an environment variable for an application/version.
140
+ * setActive sets application active/inactive (start/stop) state.
138
141
  *
139
- * @generated from rpc liquidmetal.v1alpha1.CatalogService.SetEnv
142
+ * @generated from rpc liquidmetal.v1alpha1.CatalogService.SetActive
140
143
  */
141
- setEnv: {
142
- name: "SetEnv",
143
- I: SetEnvRequest,
144
- O: SetEnvResponse,
144
+ setActive: {
145
+ name: "SetActive",
146
+ I: SetActiveRequest,
147
+ O: SetActiveResponse,
145
148
  kind: MethodKind.Unary,
146
149
  },
147
150
  /**
148
- * GetEnv gets an environment variable for an application/version.
151
+ * setSandbox sets application sandboxed/unsandboxed state.
149
152
  *
150
- * @generated from rpc liquidmetal.v1alpha1.CatalogService.GetEnv
153
+ * @generated from rpc liquidmetal.v1alpha1.CatalogService.SetSandbox
151
154
  */
152
- getEnv: {
153
- name: "GetEnv",
154
- I: GetEnvRequest,
155
- O: GetEnvResponse,
155
+ setSandbox: {
156
+ name: "SetSandbox",
157
+ I: SetSandboxRequest,
158
+ O: SetSandboxResponse,
156
159
  kind: MethodKind.Unary,
157
160
  },
158
161
  /**
159
- * QueryResources returns the physical underlying resources for a given query
162
+ * Status returns the status of an application@version.
160
163
  *
161
- * @generated from rpc liquidmetal.v1alpha1.CatalogService.QueryResources
164
+ * @generated from rpc liquidmetal.v1alpha1.CatalogService.Status
162
165
  */
163
- queryResources: {
164
- name: "QueryResources",
165
- I: QueryResourcesRequest,
166
- O: QueryResourcesResponse,
166
+ status: {
167
+ name: "Status",
168
+ I: StatusRequest,
169
+ O: StatusResponse,
167
170
  kind: MethodKind.Unary,
168
171
  },
169
172
  }