@sqlanvil/core 1.34.0 → 1.35.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 +101 -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 {
|
|
@@ -15625,7 +15625,7 @@ namespace sqlanvil {
|
|
|
15625
15625
|
}
|
|
15626
15626
|
|
|
15627
15627
|
/** Namespace google. */
|
|
15628
|
-
namespace google {
|
|
15628
|
+
declare namespace google {
|
|
15629
15629
|
|
|
15630
15630
|
/** Namespace protobuf. */
|
|
15631
15631
|
namespace protobuf {
|
|
@@ -16155,8 +16155,8 @@ namespace google {
|
|
|
16155
16155
|
}
|
|
16156
16156
|
}
|
|
16157
16157
|
|
|
16158
|
-
|
|
16159
|
-
|
|
16158
|
+
type Resolvable = string | sqlanvil.ITarget;
|
|
16159
|
+
type Contextable<Context, T> = T | ((ctx: Context) => T);
|
|
16160
16160
|
interface IActionContext {
|
|
16161
16161
|
self: () => string;
|
|
16162
16162
|
name: () => string;
|
|
@@ -16169,7 +16169,7 @@ interface ITableContext extends IActionContext {
|
|
|
16169
16169
|
when: (cond: boolean, trueCase: string, falseCase?: string) => string;
|
|
16170
16170
|
incremental: () => boolean;
|
|
16171
16171
|
}
|
|
16172
|
-
|
|
16172
|
+
type JitContext<T> = T & {
|
|
16173
16173
|
adapter: sqlanvil.DbAdapter;
|
|
16174
16174
|
data?: {
|
|
16175
16175
|
[k: string]: any;
|
|
@@ -16177,10 +16177,10 @@ declare type JitContext<T> = T & {
|
|
|
16177
16177
|
request: sqlanvil.IJitCompilationRequest;
|
|
16178
16178
|
executionData: sqlanvil.IRunningExecutionData;
|
|
16179
16179
|
};
|
|
16180
|
-
|
|
16180
|
+
type JitContextable<Context, T> = string | ((jctx: JitContext<Context>) => Promise<T>);
|
|
16181
16181
|
|
|
16182
|
-
|
|
16183
|
-
|
|
16182
|
+
type AContextable<T> = T | ((ctx: AssertionContext) => T);
|
|
16183
|
+
type JitAssertionResult = string | {
|
|
16184
16184
|
query: string;
|
|
16185
16185
|
};
|
|
16186
16186
|
declare class Assertion extends ActionBuilder<sqlanvil.Assertion> {
|
|
@@ -16339,6 +16339,28 @@ declare class Extract extends ActionBuilder<sqlanvil.Extract> {
|
|
|
16339
16339
|
compile(): sqlanvil.Extract;
|
|
16340
16340
|
}
|
|
16341
16341
|
|
|
16342
|
+
interface IForeignTableConfig {
|
|
16343
|
+
name: string;
|
|
16344
|
+
schema?: string;
|
|
16345
|
+
server: string;
|
|
16346
|
+
options?: {
|
|
16347
|
+
[key: string]: string;
|
|
16348
|
+
};
|
|
16349
|
+
columns?: {
|
|
16350
|
+
[key: string]: string;
|
|
16351
|
+
};
|
|
16352
|
+
dependsOn: string;
|
|
16353
|
+
filename?: string;
|
|
16354
|
+
}
|
|
16355
|
+
declare class ForeignTable extends ActionBuilder<sqlanvil.Operation> {
|
|
16356
|
+
private proto;
|
|
16357
|
+
private config;
|
|
16358
|
+
constructor(session: Session, config: IForeignTableConfig);
|
|
16359
|
+
getFileName(): string;
|
|
16360
|
+
getTarget(): sqlanvil.Target;
|
|
16361
|
+
compile(): sqlanvil.Operation;
|
|
16362
|
+
}
|
|
16363
|
+
|
|
16342
16364
|
declare class Import extends ActionBuilder<sqlanvil.Import> {
|
|
16343
16365
|
session: Session;
|
|
16344
16366
|
dependOnDependencyAssertions: boolean;
|
|
@@ -16358,7 +16380,7 @@ declare class Import extends ActionBuilder<sqlanvil.Import> {
|
|
|
16358
16380
|
private verifyConfig;
|
|
16359
16381
|
}
|
|
16360
16382
|
|
|
16361
|
-
|
|
16383
|
+
type JitTableResult = string | sqlanvil.IJitTableResult;
|
|
16362
16384
|
declare class Table extends ActionBuilder<sqlanvil.Table> {
|
|
16363
16385
|
session: Session;
|
|
16364
16386
|
dependOnDependencyAssertions: boolean;
|
|
@@ -16486,7 +16508,7 @@ declare class Notebook extends ActionBuilder<sqlanvil.Notebook> {
|
|
|
16486
16508
|
private verifyConfig;
|
|
16487
16509
|
}
|
|
16488
16510
|
|
|
16489
|
-
|
|
16511
|
+
type JitOperationResult = string | string[] | sqlanvil.IJitOperationResult;
|
|
16490
16512
|
declare class Operation extends ActionBuilder<sqlanvil.Operation> {
|
|
16491
16513
|
session: Session;
|
|
16492
16514
|
dependOnDependencyAssertions: boolean;
|
|
@@ -16529,6 +16551,41 @@ declare class OperationContext implements IActionContext {
|
|
|
16529
16551
|
apply<T>(value: Contextable<IActionContext, T>): T;
|
|
16530
16552
|
}
|
|
16531
16553
|
|
|
16554
|
+
interface IRealtimePublicationConfig {
|
|
16555
|
+
table: string;
|
|
16556
|
+
name?: string;
|
|
16557
|
+
events?: string[];
|
|
16558
|
+
filename?: string;
|
|
16559
|
+
dependencyTargets?: sqlanvil.ActionConfig.ITarget[];
|
|
16560
|
+
}
|
|
16561
|
+
declare class RealtimePublication extends ActionBuilder<sqlanvil.Operation> {
|
|
16562
|
+
private proto;
|
|
16563
|
+
private config;
|
|
16564
|
+
constructor(session: Session, config: IRealtimePublicationConfig);
|
|
16565
|
+
getFileName(): string;
|
|
16566
|
+
getTarget(): sqlanvil.Target;
|
|
16567
|
+
compile(): sqlanvil.Operation;
|
|
16568
|
+
}
|
|
16569
|
+
|
|
16570
|
+
interface IRlsPolicyConfig {
|
|
16571
|
+
table: string;
|
|
16572
|
+
name: string;
|
|
16573
|
+
command?: string;
|
|
16574
|
+
roles?: string[];
|
|
16575
|
+
using?: string;
|
|
16576
|
+
withCheck?: string;
|
|
16577
|
+
filename?: string;
|
|
16578
|
+
dependencyTargets?: sqlanvil.ActionConfig.ITarget[];
|
|
16579
|
+
}
|
|
16580
|
+
declare class RlsPolicy extends ActionBuilder<sqlanvil.Operation> {
|
|
16581
|
+
private proto;
|
|
16582
|
+
private config;
|
|
16583
|
+
constructor(session: Session, config: IRlsPolicyConfig);
|
|
16584
|
+
getFileName(): string;
|
|
16585
|
+
getTarget(): sqlanvil.Target;
|
|
16586
|
+
compile(): sqlanvil.Operation;
|
|
16587
|
+
}
|
|
16588
|
+
|
|
16532
16589
|
declare class Script extends ActionBuilder<sqlanvil.Script> {
|
|
16533
16590
|
session: Session;
|
|
16534
16591
|
dependOnDependencyAssertions: boolean;
|
|
@@ -16569,7 +16626,28 @@ declare class Test extends ActionBuilder<sqlanvil.Test> {
|
|
|
16569
16626
|
compile(): sqlanvil.Test;
|
|
16570
16627
|
}
|
|
16571
16628
|
|
|
16572
|
-
|
|
16629
|
+
interface IVectorIndexConfig {
|
|
16630
|
+
name: string;
|
|
16631
|
+
table: string;
|
|
16632
|
+
column: string;
|
|
16633
|
+
dimensions?: number;
|
|
16634
|
+
indexType?: string;
|
|
16635
|
+
params?: {
|
|
16636
|
+
[key: string]: string;
|
|
16637
|
+
};
|
|
16638
|
+
filename?: string;
|
|
16639
|
+
dependencyTargets?: sqlanvil.ActionConfig.ITarget[];
|
|
16640
|
+
}
|
|
16641
|
+
declare class VectorIndex extends ActionBuilder<sqlanvil.Operation> {
|
|
16642
|
+
private proto;
|
|
16643
|
+
private config;
|
|
16644
|
+
constructor(session: Session, config: IVectorIndexConfig);
|
|
16645
|
+
getFileName(): string;
|
|
16646
|
+
getTarget(): sqlanvil.Target;
|
|
16647
|
+
compile(): sqlanvil.Operation;
|
|
16648
|
+
}
|
|
16649
|
+
|
|
16650
|
+
type JitViewResult = string | sqlanvil.IJitTableResult;
|
|
16573
16651
|
declare class View extends ActionBuilder<sqlanvil.Table> {
|
|
16574
16652
|
session: Session;
|
|
16575
16653
|
dependOnDependencyAssertions: boolean;
|
|
@@ -16613,41 +16691,6 @@ declare class View extends ActionBuilder<sqlanvil.Table> {
|
|
|
16613
16691
|
private verifyConfig;
|
|
16614
16692
|
}
|
|
16615
16693
|
|
|
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
16694
|
interface IForeignTableConfigEntry {
|
|
16652
16695
|
name: string;
|
|
16653
16696
|
schema?: string;
|
|
@@ -16690,49 +16733,6 @@ declare class Wrapper extends ActionBuilder<sqlanvil.Operation> {
|
|
|
16690
16733
|
compile(): sqlanvil.Operation;
|
|
16691
16734
|
}
|
|
16692
16735
|
|
|
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
16736
|
interface IColumnsDescriptor {
|
|
16737
16737
|
[name: string]: string | IRecordDescriptor;
|
|
16738
16738
|
}
|
|
@@ -16744,7 +16744,7 @@ interface IRecordDescriptor {
|
|
|
16744
16744
|
bigqueryPolicyTags?: string | string[];
|
|
16745
16745
|
}
|
|
16746
16746
|
|
|
16747
|
-
|
|
16747
|
+
type Action = Table | View | IncrementalTable | Operation | Assertion | Declaration | Notebook | DataPreparation | Export | Extract | Import | Script | Test | RlsPolicy | RealtimePublication | Wrapper | ForeignTable | VectorIndex;
|
|
16748
16748
|
interface INamedConfig {
|
|
16749
16749
|
type?: string;
|
|
16750
16750
|
name?: string;
|
|
@@ -16767,7 +16767,7 @@ interface IDocumentableConfig {
|
|
|
16767
16767
|
columns?: IColumnsDescriptor;
|
|
16768
16768
|
description?: string;
|
|
16769
16769
|
}
|
|
16770
|
-
|
|
16770
|
+
type TableType = (typeof TableType)[number];
|
|
16771
16771
|
declare const TableType: readonly ["table", "view", "incremental"];
|
|
16772
16772
|
interface ILegacyTableConfig extends IActionConfig, IDependenciesConfig, IDocumentableConfig, INamedConfig, ITargetableConfig {
|
|
16773
16773
|
type?: TableType;
|
|
@@ -16855,10 +16855,12 @@ declare class Session {
|
|
|
16855
16855
|
incrementalWhereContextable: (ctx: ITableContext) => string;
|
|
16856
16856
|
preOperationsContextable: (ctx: ITableContext) => string[];
|
|
16857
16857
|
postOperationsContextable: (ctx: ITableContext) => string[];
|
|
16858
|
-
inputContextables: [
|
|
16859
|
-
|
|
16860
|
-
|
|
16861
|
-
|
|
16858
|
+
inputContextables: [
|
|
16859
|
+
{
|
|
16860
|
+
refName: string[];
|
|
16861
|
+
contextable: (ctx: IActionContext) => string;
|
|
16862
|
+
}
|
|
16863
|
+
];
|
|
16862
16864
|
}): void;
|
|
16863
16865
|
private findActions;
|
|
16864
16866
|
resolve(ref: Resolvable | string[], ...rest: string[]): string;
|
|
@@ -16899,15 +16901,16 @@ interface ISqlanvilExtension {
|
|
|
16899
16901
|
interface IJitCompiler {
|
|
16900
16902
|
compile: (request: Uint8Array) => Promise<Uint8Array>;
|
|
16901
16903
|
}
|
|
16902
|
-
|
|
16904
|
+
type RpcCallback = (method: string, request: Uint8Array, callback: (error: Error | null, response: Uint8Array) => void) => void;
|
|
16903
16905
|
declare function jitCompiler(rpcCallback: RpcCallback): IJitCompiler;
|
|
16904
16906
|
|
|
16905
16907
|
declare function main(coreExecutionRequest: Uint8Array | string): Uint8Array | string;
|
|
16906
16908
|
|
|
16907
|
-
declare const version = "1.
|
|
16909
|
+
declare const version = "1.35.0";
|
|
16908
16910
|
|
|
16909
16911
|
declare const session: Session;
|
|
16910
16912
|
declare const supportedFeatures: sqlanvil.SupportedFeatures[];
|
|
16911
16913
|
declare function indexFileGenerator(): void;
|
|
16912
16914
|
|
|
16913
|
-
export {
|
|
16915
|
+
export { compile as compiler, indexFileGenerator, jitCompiler, main, session, supportedFeatures, version };
|
|
16916
|
+
export type { IJitCompiler, ISqlanvilExtension };
|