@sqlanvil/core 1.34.0 → 1.36.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/README.md +5 -0
- package/bundle.d.ts +107 -98
- package/bundle.js +1 -1
- package/package.json +36 -28
package/README.md
CHANGED
|
@@ -40,6 +40,11 @@ sqlanvil compile
|
|
|
40
40
|
sqlanvil run
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
+
> **Project code runs with the CLI's privileges.** `sqlanvil compile` evaluates a project's `.sqlx`
|
|
44
|
+
> and JavaScript through Node's `node:vm`. Module resolution is confined to the project directory
|
|
45
|
+
> and `process.env` is empty inside it, but `node:vm` is not a security sandbox: only compile and
|
|
46
|
+
> run projects from sources you trust.
|
|
47
|
+
|
|
43
48
|
**`workflow_settings.yaml` (Postgres/Supabase):** the warehouse is a flat string; connection
|
|
44
49
|
secrets never live here.
|
|
45
50
|
|
package/bundle.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import Long from 'long';
|
|
|
4
4
|
declare function compile(code: string, path: string): string;
|
|
5
5
|
|
|
6
6
|
/** Namespace sqlanvil. */
|
|
7
|
-
namespace sqlanvil {
|
|
7
|
+
declare namespace sqlanvil {
|
|
8
8
|
|
|
9
9
|
/** Properties of a WorkflowSettings. */
|
|
10
10
|
interface IWorkflowSettings {
|
|
@@ -15522,6 +15522,9 @@ namespace sqlanvil {
|
|
|
15522
15522
|
|
|
15523
15523
|
/** BigQuery accessToken */
|
|
15524
15524
|
accessToken?: (string|null);
|
|
15525
|
+
|
|
15526
|
+
/** BigQuery impersonateServiceAccount */
|
|
15527
|
+
impersonateServiceAccount?: (string|null);
|
|
15525
15528
|
}
|
|
15526
15529
|
|
|
15527
15530
|
/** Represents a BigQuery. */
|
|
@@ -15545,6 +15548,9 @@ namespace sqlanvil {
|
|
|
15545
15548
|
/** BigQuery accessToken. */
|
|
15546
15549
|
public accessToken: string;
|
|
15547
15550
|
|
|
15551
|
+
/** BigQuery impersonateServiceAccount. */
|
|
15552
|
+
public impersonateServiceAccount: string;
|
|
15553
|
+
|
|
15548
15554
|
/**
|
|
15549
15555
|
* Creates a new BigQuery instance using the specified properties.
|
|
15550
15556
|
* @param [properties] Properties to set
|
|
@@ -15625,7 +15631,7 @@ namespace sqlanvil {
|
|
|
15625
15631
|
}
|
|
15626
15632
|
|
|
15627
15633
|
/** Namespace google. */
|
|
15628
|
-
namespace google {
|
|
15634
|
+
declare namespace google {
|
|
15629
15635
|
|
|
15630
15636
|
/** Namespace protobuf. */
|
|
15631
15637
|
namespace protobuf {
|
|
@@ -16155,8 +16161,8 @@ namespace google {
|
|
|
16155
16161
|
}
|
|
16156
16162
|
}
|
|
16157
16163
|
|
|
16158
|
-
|
|
16159
|
-
|
|
16164
|
+
type Resolvable = string | sqlanvil.ITarget;
|
|
16165
|
+
type Contextable<Context, T> = T | ((ctx: Context) => T);
|
|
16160
16166
|
interface IActionContext {
|
|
16161
16167
|
self: () => string;
|
|
16162
16168
|
name: () => string;
|
|
@@ -16169,7 +16175,7 @@ interface ITableContext extends IActionContext {
|
|
|
16169
16175
|
when: (cond: boolean, trueCase: string, falseCase?: string) => string;
|
|
16170
16176
|
incremental: () => boolean;
|
|
16171
16177
|
}
|
|
16172
|
-
|
|
16178
|
+
type JitContext<T> = T & {
|
|
16173
16179
|
adapter: sqlanvil.DbAdapter;
|
|
16174
16180
|
data?: {
|
|
16175
16181
|
[k: string]: any;
|
|
@@ -16177,10 +16183,10 @@ declare type JitContext<T> = T & {
|
|
|
16177
16183
|
request: sqlanvil.IJitCompilationRequest;
|
|
16178
16184
|
executionData: sqlanvil.IRunningExecutionData;
|
|
16179
16185
|
};
|
|
16180
|
-
|
|
16186
|
+
type JitContextable<Context, T> = string | ((jctx: JitContext<Context>) => Promise<T>);
|
|
16181
16187
|
|
|
16182
|
-
|
|
16183
|
-
|
|
16188
|
+
type AContextable<T> = T | ((ctx: AssertionContext) => T);
|
|
16189
|
+
type JitAssertionResult = string | {
|
|
16184
16190
|
query: string;
|
|
16185
16191
|
};
|
|
16186
16192
|
declare class Assertion extends ActionBuilder<sqlanvil.Assertion> {
|
|
@@ -16339,6 +16345,28 @@ declare class Extract extends ActionBuilder<sqlanvil.Extract> {
|
|
|
16339
16345
|
compile(): sqlanvil.Extract;
|
|
16340
16346
|
}
|
|
16341
16347
|
|
|
16348
|
+
interface IForeignTableConfig {
|
|
16349
|
+
name: string;
|
|
16350
|
+
schema?: string;
|
|
16351
|
+
server: string;
|
|
16352
|
+
options?: {
|
|
16353
|
+
[key: string]: string;
|
|
16354
|
+
};
|
|
16355
|
+
columns?: {
|
|
16356
|
+
[key: string]: string;
|
|
16357
|
+
};
|
|
16358
|
+
dependsOn: string;
|
|
16359
|
+
filename?: string;
|
|
16360
|
+
}
|
|
16361
|
+
declare class ForeignTable extends ActionBuilder<sqlanvil.Operation> {
|
|
16362
|
+
private proto;
|
|
16363
|
+
private config;
|
|
16364
|
+
constructor(session: Session, config: IForeignTableConfig);
|
|
16365
|
+
getFileName(): string;
|
|
16366
|
+
getTarget(): sqlanvil.Target;
|
|
16367
|
+
compile(): sqlanvil.Operation;
|
|
16368
|
+
}
|
|
16369
|
+
|
|
16342
16370
|
declare class Import extends ActionBuilder<sqlanvil.Import> {
|
|
16343
16371
|
session: Session;
|
|
16344
16372
|
dependOnDependencyAssertions: boolean;
|
|
@@ -16358,7 +16386,7 @@ declare class Import extends ActionBuilder<sqlanvil.Import> {
|
|
|
16358
16386
|
private verifyConfig;
|
|
16359
16387
|
}
|
|
16360
16388
|
|
|
16361
|
-
|
|
16389
|
+
type JitTableResult = string | sqlanvil.IJitTableResult;
|
|
16362
16390
|
declare class Table extends ActionBuilder<sqlanvil.Table> {
|
|
16363
16391
|
session: Session;
|
|
16364
16392
|
dependOnDependencyAssertions: boolean;
|
|
@@ -16486,7 +16514,7 @@ declare class Notebook extends ActionBuilder<sqlanvil.Notebook> {
|
|
|
16486
16514
|
private verifyConfig;
|
|
16487
16515
|
}
|
|
16488
16516
|
|
|
16489
|
-
|
|
16517
|
+
type JitOperationResult = string | string[] | sqlanvil.IJitOperationResult;
|
|
16490
16518
|
declare class Operation extends ActionBuilder<sqlanvil.Operation> {
|
|
16491
16519
|
session: Session;
|
|
16492
16520
|
dependOnDependencyAssertions: boolean;
|
|
@@ -16529,6 +16557,41 @@ declare class OperationContext implements IActionContext {
|
|
|
16529
16557
|
apply<T>(value: Contextable<IActionContext, T>): T;
|
|
16530
16558
|
}
|
|
16531
16559
|
|
|
16560
|
+
interface IRealtimePublicationConfig {
|
|
16561
|
+
table: string;
|
|
16562
|
+
name?: string;
|
|
16563
|
+
events?: string[];
|
|
16564
|
+
filename?: string;
|
|
16565
|
+
dependencyTargets?: sqlanvil.ActionConfig.ITarget[];
|
|
16566
|
+
}
|
|
16567
|
+
declare class RealtimePublication extends ActionBuilder<sqlanvil.Operation> {
|
|
16568
|
+
private proto;
|
|
16569
|
+
private config;
|
|
16570
|
+
constructor(session: Session, config: IRealtimePublicationConfig);
|
|
16571
|
+
getFileName(): string;
|
|
16572
|
+
getTarget(): sqlanvil.Target;
|
|
16573
|
+
compile(): sqlanvil.Operation;
|
|
16574
|
+
}
|
|
16575
|
+
|
|
16576
|
+
interface IRlsPolicyConfig {
|
|
16577
|
+
table: string;
|
|
16578
|
+
name: string;
|
|
16579
|
+
command?: string;
|
|
16580
|
+
roles?: string[];
|
|
16581
|
+
using?: string;
|
|
16582
|
+
withCheck?: string;
|
|
16583
|
+
filename?: string;
|
|
16584
|
+
dependencyTargets?: sqlanvil.ActionConfig.ITarget[];
|
|
16585
|
+
}
|
|
16586
|
+
declare class RlsPolicy extends ActionBuilder<sqlanvil.Operation> {
|
|
16587
|
+
private proto;
|
|
16588
|
+
private config;
|
|
16589
|
+
constructor(session: Session, config: IRlsPolicyConfig);
|
|
16590
|
+
getFileName(): string;
|
|
16591
|
+
getTarget(): sqlanvil.Target;
|
|
16592
|
+
compile(): sqlanvil.Operation;
|
|
16593
|
+
}
|
|
16594
|
+
|
|
16532
16595
|
declare class Script extends ActionBuilder<sqlanvil.Script> {
|
|
16533
16596
|
session: Session;
|
|
16534
16597
|
dependOnDependencyAssertions: boolean;
|
|
@@ -16569,7 +16632,28 @@ declare class Test extends ActionBuilder<sqlanvil.Test> {
|
|
|
16569
16632
|
compile(): sqlanvil.Test;
|
|
16570
16633
|
}
|
|
16571
16634
|
|
|
16572
|
-
|
|
16635
|
+
interface IVectorIndexConfig {
|
|
16636
|
+
name: string;
|
|
16637
|
+
table: string;
|
|
16638
|
+
column: string;
|
|
16639
|
+
dimensions?: number;
|
|
16640
|
+
indexType?: string;
|
|
16641
|
+
params?: {
|
|
16642
|
+
[key: string]: string;
|
|
16643
|
+
};
|
|
16644
|
+
filename?: string;
|
|
16645
|
+
dependencyTargets?: sqlanvil.ActionConfig.ITarget[];
|
|
16646
|
+
}
|
|
16647
|
+
declare class VectorIndex extends ActionBuilder<sqlanvil.Operation> {
|
|
16648
|
+
private proto;
|
|
16649
|
+
private config;
|
|
16650
|
+
constructor(session: Session, config: IVectorIndexConfig);
|
|
16651
|
+
getFileName(): string;
|
|
16652
|
+
getTarget(): sqlanvil.Target;
|
|
16653
|
+
compile(): sqlanvil.Operation;
|
|
16654
|
+
}
|
|
16655
|
+
|
|
16656
|
+
type JitViewResult = string | sqlanvil.IJitTableResult;
|
|
16573
16657
|
declare class View extends ActionBuilder<sqlanvil.Table> {
|
|
16574
16658
|
session: Session;
|
|
16575
16659
|
dependOnDependencyAssertions: boolean;
|
|
@@ -16613,41 +16697,6 @@ declare class View extends ActionBuilder<sqlanvil.Table> {
|
|
|
16613
16697
|
private verifyConfig;
|
|
16614
16698
|
}
|
|
16615
16699
|
|
|
16616
|
-
interface IRlsPolicyConfig {
|
|
16617
|
-
table: string;
|
|
16618
|
-
name: string;
|
|
16619
|
-
command?: string;
|
|
16620
|
-
roles?: string[];
|
|
16621
|
-
using?: string;
|
|
16622
|
-
withCheck?: string;
|
|
16623
|
-
filename?: string;
|
|
16624
|
-
dependencyTargets?: sqlanvil.ActionConfig.ITarget[];
|
|
16625
|
-
}
|
|
16626
|
-
declare class RlsPolicy extends ActionBuilder<sqlanvil.Operation> {
|
|
16627
|
-
private proto;
|
|
16628
|
-
private config;
|
|
16629
|
-
constructor(session: Session, config: IRlsPolicyConfig);
|
|
16630
|
-
getFileName(): string;
|
|
16631
|
-
getTarget(): sqlanvil.Target;
|
|
16632
|
-
compile(): sqlanvil.Operation;
|
|
16633
|
-
}
|
|
16634
|
-
|
|
16635
|
-
interface IRealtimePublicationConfig {
|
|
16636
|
-
table: string;
|
|
16637
|
-
name?: string;
|
|
16638
|
-
events?: string[];
|
|
16639
|
-
filename?: string;
|
|
16640
|
-
dependencyTargets?: sqlanvil.ActionConfig.ITarget[];
|
|
16641
|
-
}
|
|
16642
|
-
declare class RealtimePublication extends ActionBuilder<sqlanvil.Operation> {
|
|
16643
|
-
private proto;
|
|
16644
|
-
private config;
|
|
16645
|
-
constructor(session: Session, config: IRealtimePublicationConfig);
|
|
16646
|
-
getFileName(): string;
|
|
16647
|
-
getTarget(): sqlanvil.Target;
|
|
16648
|
-
compile(): sqlanvil.Operation;
|
|
16649
|
-
}
|
|
16650
|
-
|
|
16651
16700
|
interface IForeignTableConfigEntry {
|
|
16652
16701
|
name: string;
|
|
16653
16702
|
schema?: string;
|
|
@@ -16690,49 +16739,6 @@ declare class Wrapper extends ActionBuilder<sqlanvil.Operation> {
|
|
|
16690
16739
|
compile(): sqlanvil.Operation;
|
|
16691
16740
|
}
|
|
16692
16741
|
|
|
16693
|
-
interface IForeignTableConfig {
|
|
16694
|
-
name: string;
|
|
16695
|
-
schema?: string;
|
|
16696
|
-
server: string;
|
|
16697
|
-
options?: {
|
|
16698
|
-
[key: string]: string;
|
|
16699
|
-
};
|
|
16700
|
-
columns?: {
|
|
16701
|
-
[key: string]: string;
|
|
16702
|
-
};
|
|
16703
|
-
dependsOn: string;
|
|
16704
|
-
filename?: string;
|
|
16705
|
-
}
|
|
16706
|
-
declare class ForeignTable extends ActionBuilder<sqlanvil.Operation> {
|
|
16707
|
-
private proto;
|
|
16708
|
-
private config;
|
|
16709
|
-
constructor(session: Session, config: IForeignTableConfig);
|
|
16710
|
-
getFileName(): string;
|
|
16711
|
-
getTarget(): sqlanvil.Target;
|
|
16712
|
-
compile(): sqlanvil.Operation;
|
|
16713
|
-
}
|
|
16714
|
-
|
|
16715
|
-
interface IVectorIndexConfig {
|
|
16716
|
-
name: string;
|
|
16717
|
-
table: string;
|
|
16718
|
-
column: string;
|
|
16719
|
-
dimensions?: number;
|
|
16720
|
-
indexType?: string;
|
|
16721
|
-
params?: {
|
|
16722
|
-
[key: string]: string;
|
|
16723
|
-
};
|
|
16724
|
-
filename?: string;
|
|
16725
|
-
dependencyTargets?: sqlanvil.ActionConfig.ITarget[];
|
|
16726
|
-
}
|
|
16727
|
-
declare class VectorIndex extends ActionBuilder<sqlanvil.Operation> {
|
|
16728
|
-
private proto;
|
|
16729
|
-
private config;
|
|
16730
|
-
constructor(session: Session, config: IVectorIndexConfig);
|
|
16731
|
-
getFileName(): string;
|
|
16732
|
-
getTarget(): sqlanvil.Target;
|
|
16733
|
-
compile(): sqlanvil.Operation;
|
|
16734
|
-
}
|
|
16735
|
-
|
|
16736
16742
|
interface IColumnsDescriptor {
|
|
16737
16743
|
[name: string]: string | IRecordDescriptor;
|
|
16738
16744
|
}
|
|
@@ -16744,7 +16750,7 @@ interface IRecordDescriptor {
|
|
|
16744
16750
|
bigqueryPolicyTags?: string | string[];
|
|
16745
16751
|
}
|
|
16746
16752
|
|
|
16747
|
-
|
|
16753
|
+
type Action = Table | View | IncrementalTable | Operation | Assertion | Declaration | Notebook | DataPreparation | Export | Extract | Import | Script | Test | RlsPolicy | RealtimePublication | Wrapper | ForeignTable | VectorIndex;
|
|
16748
16754
|
interface INamedConfig {
|
|
16749
16755
|
type?: string;
|
|
16750
16756
|
name?: string;
|
|
@@ -16767,7 +16773,7 @@ interface IDocumentableConfig {
|
|
|
16767
16773
|
columns?: IColumnsDescriptor;
|
|
16768
16774
|
description?: string;
|
|
16769
16775
|
}
|
|
16770
|
-
|
|
16776
|
+
type TableType = (typeof TableType)[number];
|
|
16771
16777
|
declare const TableType: readonly ["table", "view", "incremental"];
|
|
16772
16778
|
interface ILegacyTableConfig extends IActionConfig, IDependenciesConfig, IDocumentableConfig, INamedConfig, ITargetableConfig {
|
|
16773
16779
|
type?: TableType;
|
|
@@ -16855,10 +16861,12 @@ declare class Session {
|
|
|
16855
16861
|
incrementalWhereContextable: (ctx: ITableContext) => string;
|
|
16856
16862
|
preOperationsContextable: (ctx: ITableContext) => string[];
|
|
16857
16863
|
postOperationsContextable: (ctx: ITableContext) => string[];
|
|
16858
|
-
inputContextables: [
|
|
16859
|
-
|
|
16860
|
-
|
|
16861
|
-
|
|
16864
|
+
inputContextables: [
|
|
16865
|
+
{
|
|
16866
|
+
refName: string[];
|
|
16867
|
+
contextable: (ctx: IActionContext) => string;
|
|
16868
|
+
}
|
|
16869
|
+
];
|
|
16862
16870
|
}): void;
|
|
16863
16871
|
private findActions;
|
|
16864
16872
|
resolve(ref: Resolvable | string[], ...rest: string[]): string;
|
|
@@ -16899,15 +16907,16 @@ interface ISqlanvilExtension {
|
|
|
16899
16907
|
interface IJitCompiler {
|
|
16900
16908
|
compile: (request: Uint8Array) => Promise<Uint8Array>;
|
|
16901
16909
|
}
|
|
16902
|
-
|
|
16910
|
+
type RpcCallback = (method: string, request: Uint8Array, callback: (error: Error | null, response: Uint8Array) => void) => void;
|
|
16903
16911
|
declare function jitCompiler(rpcCallback: RpcCallback): IJitCompiler;
|
|
16904
16912
|
|
|
16905
16913
|
declare function main(coreExecutionRequest: Uint8Array | string): Uint8Array | string;
|
|
16906
16914
|
|
|
16907
|
-
declare const version = "1.
|
|
16915
|
+
declare const version = "1.36.0";
|
|
16908
16916
|
|
|
16909
16917
|
declare const session: Session;
|
|
16910
16918
|
declare const supportedFeatures: sqlanvil.SupportedFeatures[];
|
|
16911
16919
|
declare function indexFileGenerator(): void;
|
|
16912
16920
|
|
|
16913
|
-
export {
|
|
16921
|
+
export { compile as compiler, indexFileGenerator, jitCompiler, main, session, supportedFeatures, version };
|
|
16922
|
+
export type { IJitCompiler, ISqlanvilExtension };
|