@liquidmetal-ai/drizzle 0.1.3 → 0.2.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.
- package/.turbo/turbo-lint.log +6 -0
- package/.turbo/turbo-test.log +6 -0
- package/dist/appify/build.d.ts +32 -2
- package/dist/appify/build.d.ts.map +1 -1
- package/dist/appify/build.js +166 -24
- package/dist/appify/build.test.js +75 -3
- package/dist/appify/validate.d.ts +2 -1
- package/dist/appify/validate.d.ts.map +1 -1
- package/dist/appify/validate.js +71 -2
- package/dist/appify/validate.test.js +74 -4
- package/dist/codestore.js +2 -2
- package/dist/liquidmetal/v1alpha1/catalog_connect.d.ts +81 -78
- package/dist/liquidmetal/v1alpha1/catalog_connect.d.ts.map +1 -1
- package/dist/liquidmetal/v1alpha1/catalog_connect.js +81 -78
- package/dist/liquidmetal/v1alpha1/catalog_pb.d.ts +572 -610
- package/dist/liquidmetal/v1alpha1/catalog_pb.d.ts.map +1 -1
- package/dist/liquidmetal/v1alpha1/catalog_pb.js +675 -741
- package/package.json +1 -1
- package/src/appify/build.test.ts +85 -3
- package/src/appify/build.ts +181 -25
- package/src/appify/validate.test.ts +77 -4
- package/src/appify/validate.ts +78 -1
- package/src/codestore.ts +2 -2
- package/src/liquidmetal/v1alpha1/catalog_connect.ts +81 -78
- package/src/liquidmetal/v1alpha1/catalog_pb.ts +872 -970
- package/.turbo/turbo-build.log +0 -30
package/dist/appify/build.d.ts
CHANGED
|
@@ -24,13 +24,16 @@ export declare class Application {
|
|
|
24
24
|
service: Service[];
|
|
25
25
|
observer: Observer[];
|
|
26
26
|
actor: Actor[];
|
|
27
|
+
task: Task[];
|
|
27
28
|
bucket: Bucket[];
|
|
28
29
|
queue: Queue[];
|
|
29
30
|
env: Env[];
|
|
30
31
|
sqlDatabase: SqlDatabase[];
|
|
31
32
|
vectorIndex: VectorIndex[];
|
|
33
|
+
kvStore: KvStore[];
|
|
34
|
+
smartBucket: SmartBucket[];
|
|
32
35
|
constructor(name: TokenString, obj: ConfigObject);
|
|
33
|
-
handlers(): (Service | Observer | Actor)[];
|
|
36
|
+
handlers(): (Service | Observer | Actor | Task)[];
|
|
34
37
|
}
|
|
35
38
|
export declare class Service {
|
|
36
39
|
obj: ConfigObject;
|
|
@@ -50,6 +53,16 @@ export declare class Actor {
|
|
|
50
53
|
visibility?: TokenString;
|
|
51
54
|
constructor(name: TokenString, obj: ConfigObject);
|
|
52
55
|
}
|
|
56
|
+
export declare class Task {
|
|
57
|
+
obj: ConfigObject;
|
|
58
|
+
name: TokenString;
|
|
59
|
+
type?: TokenString;
|
|
60
|
+
cron?: TokenString;
|
|
61
|
+
bindings: Binding[];
|
|
62
|
+
env: Env[];
|
|
63
|
+
visibility?: TokenString;
|
|
64
|
+
constructor(name: TokenString, obj: ConfigObject);
|
|
65
|
+
}
|
|
53
66
|
export declare class Observer {
|
|
54
67
|
obj: ConfigObject;
|
|
55
68
|
name: TokenString;
|
|
@@ -78,7 +91,9 @@ export declare class Rule {
|
|
|
78
91
|
export declare class Route {
|
|
79
92
|
obj: ConfigObject;
|
|
80
93
|
zone?: TokenString;
|
|
81
|
-
|
|
94
|
+
domain?: TokenString;
|
|
95
|
+
cname?: TokenString;
|
|
96
|
+
path?: TokenString;
|
|
82
97
|
constructor(obj: ConfigObject);
|
|
83
98
|
}
|
|
84
99
|
export declare class Domain {
|
|
@@ -100,6 +115,13 @@ export declare class Env {
|
|
|
100
115
|
constructor(name: TokenString, obj: ConfigObject);
|
|
101
116
|
}
|
|
102
117
|
export declare class Bucket {
|
|
118
|
+
name: TokenString;
|
|
119
|
+
visibility?: TokenString;
|
|
120
|
+
locationHint?: TokenString;
|
|
121
|
+
obj: ConfigObject;
|
|
122
|
+
constructor(name: TokenString, obj: ConfigObject);
|
|
123
|
+
}
|
|
124
|
+
export declare class KvStore {
|
|
103
125
|
name: TokenString;
|
|
104
126
|
visibility?: TokenString;
|
|
105
127
|
obj: ConfigObject;
|
|
@@ -126,6 +148,14 @@ export declare class SqlDatabase {
|
|
|
126
148
|
obj: ConfigObject;
|
|
127
149
|
constructor(name: TokenString, obj: ConfigObject);
|
|
128
150
|
}
|
|
151
|
+
export declare class SmartBucket {
|
|
152
|
+
name: TokenString;
|
|
153
|
+
locationHint?: TokenString;
|
|
154
|
+
obj: ConfigObject;
|
|
155
|
+
constructor(name: TokenString, obj: ConfigObject);
|
|
156
|
+
}
|
|
129
157
|
export declare const VISIBILITIES: readonly ["none", "public", "private", "protected", "application", "suite", "tenant"];
|
|
130
158
|
export type Visibility = (typeof VISIBILITIES)[number];
|
|
159
|
+
export declare const TASK_TYPES: readonly ["cron"];
|
|
160
|
+
export type TaskType = (typeof TASK_TYPES)[number];
|
|
131
161
|
//# sourceMappingURL=build.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/appify/build.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,cAAc,EACd,SAAS,EAGT,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,EACZ,MAAM,YAAY,CAAC;AAEpB,wBAAgB,OAAO,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAAC;AACpD,wBAAgB,OAAO,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAAC;AACpD,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC;AAgBtD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,qBAAa,WAAW;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;gBAEA,OAAO,EAAE,MAAM,EAAE,GAAG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AAE,YAAY;CAIjD;AAED,qBAAa,WAAW;IACtB,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,GAAG,EAAE,YAAY,CAAC;gBAEN,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,YAAY;CAIjD;AAED,qBAAa,WAAW;IACtB,IAAI,EAAE,WAAW,CAAC;IAClB,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,GAAG,EAAE,YAAY,CAAC;gBAEN,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,YAAY;CAIjD;AAED,eAAO,MAAM,YAAY,uFAAwF,CAAC;AAClH,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,eAAO,MAAM,UAAU,mBAAoB,CAAC;AAC5C,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
package/dist/appify/build.js
CHANGED
|
@@ -10,7 +10,7 @@ export function valueOf(token) {
|
|
|
10
10
|
if (token.type === 'string') {
|
|
11
11
|
return token.value.slice(1, -1);
|
|
12
12
|
}
|
|
13
|
-
throw new Error(`unexpected token type`);
|
|
13
|
+
throw new Error(`unexpected token type: ${token}`);
|
|
14
14
|
}
|
|
15
15
|
export class ConfigError {
|
|
16
16
|
message;
|
|
@@ -127,6 +127,9 @@ export function buildApplication(node) {
|
|
|
127
127
|
case 'actor':
|
|
128
128
|
buildStanza(buildActor, child, app.actor, errors);
|
|
129
129
|
break;
|
|
130
|
+
case 'task':
|
|
131
|
+
buildStanza(buildTask, child, app.task, errors);
|
|
132
|
+
break;
|
|
130
133
|
case 'bucket':
|
|
131
134
|
buildStanza(buildBucket, child, app.bucket, errors);
|
|
132
135
|
break;
|
|
@@ -139,8 +142,14 @@ export function buildApplication(node) {
|
|
|
139
142
|
case 'sql_database':
|
|
140
143
|
buildStanza(buildSqlDatabase, child, app.sqlDatabase, errors);
|
|
141
144
|
break;
|
|
145
|
+
case 'kv_store':
|
|
146
|
+
buildStanza(buildKvStore, child, app.kvStore, errors);
|
|
147
|
+
break;
|
|
148
|
+
case 'smartbucket':
|
|
149
|
+
buildStanza(buildSmartBucket, child, app.smartBucket, errors);
|
|
150
|
+
break;
|
|
142
151
|
default:
|
|
143
|
-
errors.push({ message:
|
|
152
|
+
errors.push({ message: 'unexpected stanza', ...child });
|
|
144
153
|
}
|
|
145
154
|
break;
|
|
146
155
|
case 'assignment':
|
|
@@ -179,7 +188,7 @@ function buildService(stanza) {
|
|
|
179
188
|
buildStanza(buildEnv, child, service.env, errors);
|
|
180
189
|
break;
|
|
181
190
|
default:
|
|
182
|
-
errors.push({ message:
|
|
191
|
+
errors.push({ message: 'unexpected stanza', ...child });
|
|
183
192
|
}
|
|
184
193
|
break;
|
|
185
194
|
case 'assignment':
|
|
@@ -208,13 +217,16 @@ function buildBucket(stanza) {
|
|
|
208
217
|
for (const child of stanza.block?.children ?? []) {
|
|
209
218
|
switch (child.type) {
|
|
210
219
|
case 'stanza':
|
|
211
|
-
errors.push({ message:
|
|
220
|
+
errors.push({ message: 'unexpected stanza', ...child });
|
|
212
221
|
break;
|
|
213
222
|
case 'assignment':
|
|
214
223
|
switch (child.key.value) {
|
|
215
224
|
case 'visibility':
|
|
216
225
|
buildAssignment(bucket, 'visibility', 'string', child, errors);
|
|
217
226
|
break;
|
|
227
|
+
case 'location_hint':
|
|
228
|
+
buildAssignment(bucket, 'locationHint', 'string', child, errors);
|
|
229
|
+
break;
|
|
218
230
|
default:
|
|
219
231
|
errors.push({ message: 'unexpected assignment', ...child });
|
|
220
232
|
}
|
|
@@ -236,7 +248,7 @@ function buildQueue(stanza) {
|
|
|
236
248
|
for (const child of stanza.block?.children ?? []) {
|
|
237
249
|
switch (child.type) {
|
|
238
250
|
case 'stanza':
|
|
239
|
-
errors.push({ message:
|
|
251
|
+
errors.push({ message: 'unexpected stanza', ...child });
|
|
240
252
|
break;
|
|
241
253
|
case 'assignment':
|
|
242
254
|
switch (child.key.value) {
|
|
@@ -264,7 +276,7 @@ function buildVectorIndex(stanza) {
|
|
|
264
276
|
for (const child of stanza.block?.children ?? []) {
|
|
265
277
|
switch (child.type) {
|
|
266
278
|
case 'stanza':
|
|
267
|
-
errors.push({ message:
|
|
279
|
+
errors.push({ message: 'unexpected stanza', ...child });
|
|
268
280
|
break;
|
|
269
281
|
case 'assignment':
|
|
270
282
|
switch (child.key.value) {
|
|
@@ -298,7 +310,7 @@ function buildSqlDatabase(stanza) {
|
|
|
298
310
|
for (const child of stanza.block?.children ?? []) {
|
|
299
311
|
switch (child.type) {
|
|
300
312
|
case 'stanza':
|
|
301
|
-
errors.push({ message:
|
|
313
|
+
errors.push({ message: 'unexpected stanza', ...child });
|
|
302
314
|
break;
|
|
303
315
|
case 'assignment':
|
|
304
316
|
switch (child.key.value) {
|
|
@@ -318,6 +330,59 @@ function buildSqlDatabase(stanza) {
|
|
|
318
330
|
}
|
|
319
331
|
return [sqlDatabase, errors];
|
|
320
332
|
}
|
|
333
|
+
function buildKvStore(stanza) {
|
|
334
|
+
const errors = [];
|
|
335
|
+
const [name, nameErrors] = buildName1(stanza);
|
|
336
|
+
errors.push(...nameErrors);
|
|
337
|
+
const kvStore = new KvStore(name, stanza);
|
|
338
|
+
for (const child of stanza.block?.children ?? []) {
|
|
339
|
+
switch (child.type) {
|
|
340
|
+
case 'stanza':
|
|
341
|
+
errors.push({ message: 'unexpected stanza', ...child });
|
|
342
|
+
break;
|
|
343
|
+
case 'assignment':
|
|
344
|
+
switch (child.key.value) {
|
|
345
|
+
case 'visibility':
|
|
346
|
+
buildAssignment(kvStore, 'visibility', 'string', child, errors);
|
|
347
|
+
break;
|
|
348
|
+
default:
|
|
349
|
+
errors.push({ message: 'unexpected assignment', ...child });
|
|
350
|
+
}
|
|
351
|
+
break;
|
|
352
|
+
case 'comment':
|
|
353
|
+
case 'newline':
|
|
354
|
+
break;
|
|
355
|
+
default:
|
|
356
|
+
errors.push({ message: `unexpected ${child.type}`, ...child });
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return [kvStore, errors];
|
|
360
|
+
}
|
|
361
|
+
function buildSmartBucket(stanza) {
|
|
362
|
+
const errors = [];
|
|
363
|
+
const [name, nameErrors] = buildName1(stanza);
|
|
364
|
+
errors.push(...nameErrors);
|
|
365
|
+
const smartBucket = new SmartBucket(name, stanza);
|
|
366
|
+
for (const child of stanza.block?.children ?? []) {
|
|
367
|
+
switch (child.type) {
|
|
368
|
+
case 'assignment':
|
|
369
|
+
switch (child.key.value) {
|
|
370
|
+
case 'location_hint':
|
|
371
|
+
buildAssignment(smartBucket, 'locationHint', 'string', child, errors);
|
|
372
|
+
break;
|
|
373
|
+
default:
|
|
374
|
+
errors.push({ message: 'unexpected assignment', ...child });
|
|
375
|
+
}
|
|
376
|
+
break;
|
|
377
|
+
case 'comment':
|
|
378
|
+
case 'newline':
|
|
379
|
+
break;
|
|
380
|
+
default:
|
|
381
|
+
errors.push({ message: `unexpected ${child.type}`, ...child });
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
return [smartBucket, errors];
|
|
385
|
+
}
|
|
321
386
|
function buildObserver(stanza) {
|
|
322
387
|
const errors = [];
|
|
323
388
|
const [name, nameErrors] = buildName1(stanza);
|
|
@@ -338,7 +403,7 @@ function buildObserver(stanza) {
|
|
|
338
403
|
buildStanza(buildEnv, child, observer.env, errors);
|
|
339
404
|
break;
|
|
340
405
|
default:
|
|
341
|
-
errors.push({ message:
|
|
406
|
+
errors.push({ message: 'unexpected stanza', ...child });
|
|
342
407
|
}
|
|
343
408
|
break;
|
|
344
409
|
case 'assignment':
|
|
@@ -370,7 +435,7 @@ function buildActor(stanza) {
|
|
|
370
435
|
buildStanza(buildEnv, child, actor.env, errors);
|
|
371
436
|
break;
|
|
372
437
|
default:
|
|
373
|
-
errors.push({ message:
|
|
438
|
+
errors.push({ message: 'unexpected stanza', ...child });
|
|
374
439
|
}
|
|
375
440
|
break;
|
|
376
441
|
case 'assignment':
|
|
@@ -392,6 +457,45 @@ function buildActor(stanza) {
|
|
|
392
457
|
}
|
|
393
458
|
return [actor, errors];
|
|
394
459
|
}
|
|
460
|
+
function buildTask(stanza) {
|
|
461
|
+
const errors = [];
|
|
462
|
+
const [name, nameErrors] = buildName1(stanza);
|
|
463
|
+
errors.push(...nameErrors);
|
|
464
|
+
const task = new Task(name, stanza);
|
|
465
|
+
const children = stanza.block ? stanza.block.children : [];
|
|
466
|
+
for (const child of children) {
|
|
467
|
+
switch (child.type) {
|
|
468
|
+
case 'stanza':
|
|
469
|
+
switch (child.name) {
|
|
470
|
+
case 'binding':
|
|
471
|
+
buildStanza(buildBinding, child, task.bindings, errors);
|
|
472
|
+
break;
|
|
473
|
+
case 'env':
|
|
474
|
+
buildStanza(buildEnv, child, task.env, errors);
|
|
475
|
+
break;
|
|
476
|
+
default:
|
|
477
|
+
errors.push({ message: 'unexpected stanza', ...child });
|
|
478
|
+
}
|
|
479
|
+
break;
|
|
480
|
+
case 'assignment':
|
|
481
|
+
switch (child.key.value) {
|
|
482
|
+
case 'type':
|
|
483
|
+
buildAssignment(task, 'type', 'string', child, errors);
|
|
484
|
+
break;
|
|
485
|
+
case 'cron':
|
|
486
|
+
buildAssignment(task, 'cron', 'string', child, errors);
|
|
487
|
+
break;
|
|
488
|
+
case 'visibility':
|
|
489
|
+
buildAssignment(task, 'visibility', 'string', child, errors);
|
|
490
|
+
break;
|
|
491
|
+
default:
|
|
492
|
+
errors.push({ message: 'unexpected assignment', ...child });
|
|
493
|
+
}
|
|
494
|
+
break;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
return [task, errors];
|
|
498
|
+
}
|
|
395
499
|
function buildSource(stanza) {
|
|
396
500
|
const errors = [];
|
|
397
501
|
const source = new Source(stanza);
|
|
@@ -443,14 +547,14 @@ function buildSource(stanza) {
|
|
|
443
547
|
buildAssignment(rule, 'suffix', 'string', ruleChild, errors);
|
|
444
548
|
break;
|
|
445
549
|
default:
|
|
446
|
-
errors.push({ message:
|
|
550
|
+
errors.push({ message: 'unexpected assignment', ...ruleChild });
|
|
447
551
|
}
|
|
448
552
|
}
|
|
449
553
|
}
|
|
450
554
|
source.rule.push(rule);
|
|
451
555
|
}
|
|
452
556
|
else {
|
|
453
|
-
errors.push({ message:
|
|
557
|
+
errors.push({ message: 'unexpected stanza', ...child });
|
|
454
558
|
}
|
|
455
559
|
}
|
|
456
560
|
}
|
|
@@ -465,26 +569,26 @@ function buildRoute(stanza) {
|
|
|
465
569
|
for (const child of stanza.block?.children ?? []) {
|
|
466
570
|
if (child.type === 'assignment') {
|
|
467
571
|
switch (child.key.value) {
|
|
572
|
+
case 'cname':
|
|
573
|
+
buildAssignment(route, 'cname', 'string', child, errors);
|
|
574
|
+
break;
|
|
575
|
+
case 'domain':
|
|
576
|
+
buildAssignment(route, 'domain', 'string', child, errors);
|
|
577
|
+
break;
|
|
578
|
+
case 'path':
|
|
579
|
+
buildAssignment(route, 'path', 'string', child, errors);
|
|
580
|
+
break;
|
|
468
581
|
case 'zone':
|
|
469
582
|
buildAssignment(route, 'zone', 'string', child, errors);
|
|
470
583
|
break;
|
|
471
|
-
case 'pattern':
|
|
472
|
-
buildAssignment(route, 'pattern', 'string', child, errors);
|
|
473
|
-
break;
|
|
474
584
|
default:
|
|
475
585
|
errors.push({ message: `unexpected assignment ${child.key}`, ...child });
|
|
476
586
|
}
|
|
477
587
|
}
|
|
478
588
|
}
|
|
479
|
-
if (
|
|
480
|
-
errors.push({ message: '
|
|
481
|
-
return [undefined, errors];
|
|
482
|
-
}
|
|
483
|
-
if (!route.pattern) {
|
|
484
|
-
errors.push({ message: 'missing pattern assignment', ...stanza });
|
|
485
|
-
return [undefined, errors];
|
|
589
|
+
if (route.cname && route.domain) {
|
|
590
|
+
errors.push({ message: 'cname cannot be used with domain', ...stanza });
|
|
486
591
|
}
|
|
487
|
-
// TODO [ian]: validate zone and pattern contents.
|
|
488
592
|
return [route, errors];
|
|
489
593
|
}
|
|
490
594
|
function buildDomain(stanza) {
|
|
@@ -558,18 +662,21 @@ export class Application {
|
|
|
558
662
|
service = [];
|
|
559
663
|
observer = [];
|
|
560
664
|
actor = [];
|
|
665
|
+
task = [];
|
|
561
666
|
bucket = [];
|
|
562
667
|
queue = [];
|
|
563
668
|
env = [];
|
|
564
669
|
sqlDatabase = [];
|
|
565
670
|
vectorIndex = [];
|
|
671
|
+
kvStore = [];
|
|
672
|
+
smartBucket = [];
|
|
566
673
|
constructor(name, obj) {
|
|
567
674
|
this.name = name;
|
|
568
675
|
this.obj = obj;
|
|
569
676
|
}
|
|
570
677
|
// Return all objects that require code handlers.
|
|
571
678
|
handlers() {
|
|
572
|
-
return [...this.service, ...this.observer, ...this.actor];
|
|
679
|
+
return [...this.service, ...this.observer, ...this.actor, ...this.task];
|
|
573
680
|
}
|
|
574
681
|
}
|
|
575
682
|
export class Service {
|
|
@@ -596,6 +703,19 @@ export class Actor {
|
|
|
596
703
|
this.obj = obj;
|
|
597
704
|
}
|
|
598
705
|
}
|
|
706
|
+
export class Task {
|
|
707
|
+
obj;
|
|
708
|
+
name;
|
|
709
|
+
type;
|
|
710
|
+
cron;
|
|
711
|
+
bindings = [];
|
|
712
|
+
env = [];
|
|
713
|
+
visibility;
|
|
714
|
+
constructor(name, obj) {
|
|
715
|
+
this.name = name;
|
|
716
|
+
this.obj = obj;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
599
719
|
export class Observer {
|
|
600
720
|
obj;
|
|
601
721
|
name;
|
|
@@ -631,7 +751,9 @@ export class Rule {
|
|
|
631
751
|
export class Route {
|
|
632
752
|
obj;
|
|
633
753
|
zone;
|
|
634
|
-
|
|
754
|
+
domain;
|
|
755
|
+
cname;
|
|
756
|
+
path;
|
|
635
757
|
constructor(obj) {
|
|
636
758
|
this.obj = obj;
|
|
637
759
|
}
|
|
@@ -663,6 +785,16 @@ export class Env {
|
|
|
663
785
|
}
|
|
664
786
|
}
|
|
665
787
|
export class Bucket {
|
|
788
|
+
name;
|
|
789
|
+
visibility;
|
|
790
|
+
locationHint;
|
|
791
|
+
obj;
|
|
792
|
+
constructor(name, obj) {
|
|
793
|
+
this.name = name;
|
|
794
|
+
this.obj = obj;
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
export class KvStore {
|
|
666
798
|
name;
|
|
667
799
|
visibility;
|
|
668
800
|
obj;
|
|
@@ -701,4 +833,14 @@ export class SqlDatabase {
|
|
|
701
833
|
this.obj = obj;
|
|
702
834
|
}
|
|
703
835
|
}
|
|
836
|
+
export class SmartBucket {
|
|
837
|
+
name;
|
|
838
|
+
locationHint;
|
|
839
|
+
obj;
|
|
840
|
+
constructor(name, obj) {
|
|
841
|
+
this.name = name;
|
|
842
|
+
this.obj = obj;
|
|
843
|
+
}
|
|
844
|
+
}
|
|
704
845
|
export const VISIBILITIES = ['none', 'public', 'private', 'protected', 'application', 'suite', 'tenant'];
|
|
846
|
+
export const TASK_TYPES = ['cron'];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { expect, test } from 'vitest';
|
|
2
|
-
import { buildManifest } from './build.js';
|
|
2
|
+
import { buildManifest, valueOf } from './build.js';
|
|
3
3
|
import { Parser, Tokenizer } from './parse.js';
|
|
4
4
|
const CONFIG = `
|
|
5
5
|
application "my-app" {
|
|
@@ -8,7 +8,7 @@ application "my-app" {
|
|
|
8
8
|
service "my-service" {
|
|
9
9
|
route {
|
|
10
10
|
zone = "testymctestface.com"
|
|
11
|
-
|
|
11
|
+
domain = "testymctestface.com"
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
domain {
|
|
@@ -35,6 +35,10 @@ application "my-app" {
|
|
|
35
35
|
visibility = 'public'
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
smartbucket "my-smart-bucket" {
|
|
39
|
+
location_hint = "enam"
|
|
40
|
+
}
|
|
41
|
+
|
|
38
42
|
observer "my-observer" {
|
|
39
43
|
env "API_KEY" {}
|
|
40
44
|
source {
|
|
@@ -62,9 +66,15 @@ application "my-app" {
|
|
|
62
66
|
sql_database "my-database" {}
|
|
63
67
|
|
|
64
68
|
vector_index "my-index" {
|
|
65
|
-
|
|
69
|
+
dimensions = 768
|
|
66
70
|
metric = 'cosine'
|
|
67
71
|
}
|
|
72
|
+
|
|
73
|
+
task "my-task" {
|
|
74
|
+
type = "cron"
|
|
75
|
+
cron = "* * * * *"
|
|
76
|
+
visibility = 'protected'
|
|
77
|
+
}
|
|
68
78
|
}
|
|
69
79
|
`;
|
|
70
80
|
test('manifest with no errors', () => {
|
|
@@ -107,3 +117,65 @@ application "foo" {
|
|
|
107
117
|
},
|
|
108
118
|
]);
|
|
109
119
|
});
|
|
120
|
+
test('smartbucket parsing', () => {
|
|
121
|
+
const CONFIG = `
|
|
122
|
+
application "my-app" {
|
|
123
|
+
smartbucket "my-smart-bucket" {
|
|
124
|
+
location_hint = "enam"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
`;
|
|
128
|
+
const tokenizer = new Tokenizer(CONFIG);
|
|
129
|
+
const parser = new Parser(tokenizer);
|
|
130
|
+
const ast = parser.parse();
|
|
131
|
+
expect(parser.errors).toEqual([]);
|
|
132
|
+
const [apps, errors] = buildManifest(ast);
|
|
133
|
+
expect(errors).toEqual([]);
|
|
134
|
+
// Check that we have exactly one application
|
|
135
|
+
expect(apps.length).toBe(1);
|
|
136
|
+
// Check that we have exactly one smartbucket
|
|
137
|
+
expect(apps[0].smartBucket.length).toBe(1);
|
|
138
|
+
// Check the smartbucket properties
|
|
139
|
+
const smartBucket = apps[0].smartBucket[0];
|
|
140
|
+
expect(valueOf(smartBucket.name)).toBe("my-smart-bucket");
|
|
141
|
+
expect(smartBucket.locationHint).toBeDefined();
|
|
142
|
+
expect(valueOf(smartBucket.locationHint)).toBe("enam");
|
|
143
|
+
});
|
|
144
|
+
test('smartbucket with invalid properties', () => {
|
|
145
|
+
const CONFIG = `
|
|
146
|
+
application "my-app" {
|
|
147
|
+
smartbucket "my-smart-bucket" {
|
|
148
|
+
location_hint = "enam"
|
|
149
|
+
invalid_property = "should fail"
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
`;
|
|
153
|
+
const tokenizer = new Tokenizer(CONFIG);
|
|
154
|
+
const parser = new Parser(tokenizer);
|
|
155
|
+
const ast = parser.parse();
|
|
156
|
+
expect(parser.errors).toEqual([]);
|
|
157
|
+
const [, errors] = buildManifest(ast);
|
|
158
|
+
// Should have one error for the invalid property
|
|
159
|
+
expect(errors.length).toBe(1);
|
|
160
|
+
expect(errors[0].message).toContain('unexpected assignment');
|
|
161
|
+
});
|
|
162
|
+
test('smartbucket with duplicate assignment', () => {
|
|
163
|
+
const CONFIG = `
|
|
164
|
+
application "foo" {
|
|
165
|
+
smartbucket "my-smart-bucket" {
|
|
166
|
+
location_hint = "enam"
|
|
167
|
+
location_hint = "other-location"
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
`;
|
|
171
|
+
const tokenizer = new Tokenizer(CONFIG);
|
|
172
|
+
const parser = new Parser(tokenizer);
|
|
173
|
+
const ast = parser.parse();
|
|
174
|
+
expect(parser.errors).toEqual([]);
|
|
175
|
+
const [, errors] = buildManifest(ast);
|
|
176
|
+
expect(errors).toMatchObject([
|
|
177
|
+
{
|
|
178
|
+
message: 'duplicate location_hint assignment "other-location"',
|
|
179
|
+
},
|
|
180
|
+
]);
|
|
181
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Actor, Application, Binding, Bucket, ConfigObject, Domain, Env, Observer, Queue, Service, SqlDatabase, VectorIndex } from './build.js';
|
|
1
|
+
import { Actor, Application, Binding, Bucket, ConfigObject, Domain, Env, Observer, Queue, Service, SqlDatabase, Task, VectorIndex } from './build.js';
|
|
2
2
|
export type ValidationError = ConfigObject & {
|
|
3
3
|
message: string;
|
|
4
4
|
severity: 'info' | 'error' | 'warning';
|
|
@@ -9,6 +9,7 @@ export type Validator = {
|
|
|
9
9
|
onService?: On<Service>;
|
|
10
10
|
onActor?: On<Actor>;
|
|
11
11
|
onObserver?: On<Observer>;
|
|
12
|
+
onTask?: On<Task>;
|
|
12
13
|
onBucket?: On<Bucket>;
|
|
13
14
|
onQueue?: On<Queue>;
|
|
14
15
|
onEnv?: On<Env>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/appify/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,WAAW,EACX,OAAO,EACP,MAAM,EACN,YAAY,EACZ,MAAM,EACN,GAAG,EACH,QAAQ,EACR,KAAK,EACL,OAAO,EACP,WAAW,
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/appify/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,WAAW,EACX,OAAO,EACP,MAAM,EACN,YAAY,EACZ,MAAM,EACN,GAAG,EACH,QAAQ,EACR,KAAK,EACL,OAAO,EACP,WAAW,EACX,IAAI,EAIJ,WAAW,EAEZ,MAAM,YAAY,CAAC;AAOpB,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;AAE7E,MAAM,MAAM,SAAS,GAAG;IACtB,aAAa,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC;IAChC,SAAS,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC;IACxB,OAAO,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;IACpB,UAAU,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC;IAC1B,MAAM,CA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