@zlens/notebook 0.0.0-stage → 0.2.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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,5 @@
1
+ DQL
2
+ Copyright 2026 DuckCode AI Labs
3
+
4
+ This product includes software developed by DuckCode AI Labs
5
+ (https://github.com/duckcode-ai-labs/zlens).
@@ -0,0 +1,22 @@
1
+ import type { ConnectionConfig } from '@zlens/connectors';
2
+ export interface ConnectorFieldSchema {
3
+ key: keyof ConnectionConfig | 'name';
4
+ label: string;
5
+ type: 'text' | 'number' | 'password' | 'checkbox' | 'select' | 'textarea';
6
+ placeholder?: string;
7
+ required?: boolean;
8
+ options?: Array<{
9
+ value: string;
10
+ label: string;
11
+ }>;
12
+ helpText?: string;
13
+ }
14
+ export interface ConnectorFormSchema {
15
+ driver: ConnectionConfig['driver'];
16
+ label: string;
17
+ category: 'local' | 'warehouse' | 'lakehouse';
18
+ description: string;
19
+ fields: ConnectorFieldSchema[];
20
+ }
21
+ export declare function getConnectorFormSchemas(): ConnectorFormSchema[];
22
+ //# sourceMappingURL=connector-forms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connector-forms.d.ts","sourceRoot":"","sources":["../src/connector-forms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,gBAAgB,GAAG,MAAM,CAAC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAC;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,GAAG,WAAW,GAAG,WAAW,CAAC;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,oBAAoB,EAAE,CAAC;CAChC;AAsGD,wBAAgB,uBAAuB,IAAI,mBAAmB,EAAE,CAE/D"}
@@ -0,0 +1,103 @@
1
+ const schemas = [
2
+ {
3
+ driver: 'duckdb',
4
+ label: 'DuckDB',
5
+ category: 'local',
6
+ description: 'Connect directly to a local DuckDB database file.',
7
+ fields: [
8
+ { key: 'filepath', label: 'DuckDB file path', type: 'text', placeholder: './local/dev.duckdb', required: true },
9
+ ],
10
+ },
11
+ {
12
+ driver: 'snowflake',
13
+ label: 'Snowflake',
14
+ category: 'warehouse',
15
+ description: 'Snowflake account, warehouse, database, and role.',
16
+ fields: [
17
+ { key: 'account', label: 'Account', type: 'text', required: true },
18
+ { key: 'warehouse', label: 'Warehouse', type: 'text', required: true },
19
+ { key: 'database', label: 'Database', type: 'text', required: true },
20
+ { key: 'schema', label: 'Schema', type: 'text', required: true },
21
+ { key: 'username', label: 'Username', type: 'text', required: true },
22
+ {
23
+ key: 'authMethod',
24
+ label: 'Authentication',
25
+ type: 'select',
26
+ options: [
27
+ { value: 'password', label: 'Password' },
28
+ { value: 'mfa', label: 'Password + MFA' },
29
+ { value: 'key_pair', label: 'Key pair / private key' },
30
+ { value: 'external_browser', label: 'SSO / external browser' },
31
+ { value: 'oauth', label: 'OAuth token' },
32
+ { value: 'oauth_authorization_code', label: 'OAuth authorization code' },
33
+ { value: 'oauth_client_credentials', label: 'OAuth client credentials' },
34
+ { value: 'programmatic_access_token', label: 'Programmatic access token' },
35
+ { value: 'workload_identity', label: 'Workload identity' },
36
+ ],
37
+ },
38
+ { key: 'password', label: 'Password', type: 'password' },
39
+ { key: 'token', label: 'Token', type: 'password', helpText: 'OAuth, programmatic access token, or OIDC workload identity token.' },
40
+ { key: 'privateKeyPath', label: 'Private key file path', type: 'text', placeholder: '~/.ssh/snowflake_key.p8' },
41
+ { key: 'privateKey', label: 'Private key PEM', type: 'textarea', helpText: 'Paste PEM only when a key file cannot be referenced.' },
42
+ { key: 'privateKeyPassphrase', label: 'Private key passphrase', type: 'password' },
43
+ { key: 'authenticator', label: 'Authenticator override', type: 'text', placeholder: 'EXTERNALBROWSER, OAUTH, WORKLOAD_IDENTITY, or Okta URL' },
44
+ { key: 'role', label: 'Role', type: 'text' },
45
+ { key: 'accessUrl', label: 'Access URL', type: 'text' },
46
+ { key: 'application', label: 'Application name', type: 'text', placeholder: 'DQL' },
47
+ { key: 'queryTag', label: 'Query tag', type: 'text', placeholder: 'team=analytics;app=dql' },
48
+ { key: 'passcode', label: 'MFA passcode', type: 'password' },
49
+ { key: 'passcodeInPassword', label: 'MFA passcode is appended to password', type: 'checkbox' },
50
+ { key: 'clientRequestMFAToken', label: 'Reuse cached MFA token', type: 'checkbox' },
51
+ { key: 'clientStoreTemporaryCredential', label: 'Cache SSO token locally', type: 'checkbox' },
52
+ { key: 'clientSessionKeepAlive', label: 'Keep session alive', type: 'checkbox' },
53
+ { key: 'clientSessionKeepAliveHeartbeatFrequency', label: 'Keep-alive heartbeat seconds', type: 'number', placeholder: '3600' },
54
+ { key: 'credentialCacheDir', label: 'Credential cache directory', type: 'text' },
55
+ { key: 'browserActionTimeout', label: 'Browser SSO timeout ms', type: 'number', placeholder: '120000' },
56
+ { key: 'keepAlive', label: 'Socket keep-alive', type: 'checkbox' },
57
+ { key: 'timeout', label: 'Connection timeout ms', type: 'number', placeholder: '60000' },
58
+ { key: 'proxyHost', label: 'Proxy host', type: 'text' },
59
+ { key: 'proxyPort', label: 'Proxy port', type: 'number' },
60
+ { key: 'proxyProtocol', label: 'Proxy protocol', type: 'text', placeholder: 'https' },
61
+ { key: 'proxyUser', label: 'Proxy user', type: 'text' },
62
+ { key: 'proxyPassword', label: 'Proxy password', type: 'password' },
63
+ { key: 'noProxy', label: 'No proxy hosts', type: 'text', placeholder: '*.amazonaws.com|*.internal' },
64
+ { key: 'oauthClientId', label: 'OAuth client ID', type: 'text' },
65
+ { key: 'oauthClientSecret', label: 'OAuth client secret', type: 'password' },
66
+ { key: 'oauthAuthorizationUrl', label: 'OAuth authorization URL', type: 'text' },
67
+ { key: 'oauthTokenRequestUrl', label: 'OAuth token request URL', type: 'text' },
68
+ { key: 'oauthScope', label: 'OAuth scope', type: 'text' },
69
+ { key: 'oauthRedirectUri', label: 'OAuth redirect URI', type: 'text' },
70
+ { key: 'workloadIdentityProvider', label: 'Workload identity provider', type: 'text', placeholder: 'AWS, AZURE, GCP, or OIDC' },
71
+ { key: 'workloadIdentityAzureClientId', label: 'Azure client ID', type: 'text' },
72
+ ],
73
+ },
74
+ {
75
+ driver: 'databricks',
76
+ label: 'Databricks SQL',
77
+ category: 'lakehouse',
78
+ description: 'Databricks workspace, SQL warehouse, and bearer token.',
79
+ fields: [
80
+ { key: 'host', label: 'Workspace URL', type: 'text', required: true, placeholder: 'https://adb-123.cloud.databricks.com' },
81
+ { key: 'database', label: 'Catalog / database', type: 'text' },
82
+ { key: 'schema', label: 'Schema', type: 'text' },
83
+ { key: 'warehouse', label: 'Warehouse ID', type: 'text', helpText: 'Use the SQL warehouse ID when you have it.' },
84
+ { key: 'httpPath', label: 'SQL warehouse ID or path', type: 'text', placeholder: '/sql/1.0/warehouses/abc123', helpText: 'Paste the warehouse ID or its JDBC/HTTP path.' },
85
+ {
86
+ key: 'authMethod',
87
+ label: 'Authentication',
88
+ type: 'select',
89
+ options: [
90
+ { value: 'token', label: 'Access token' },
91
+ { value: 'oauth', label: 'OAuth bearer token' },
92
+ ],
93
+ },
94
+ { key: 'token', label: 'Bearer token', type: 'password', required: true, helpText: 'Use an OAuth token for automation when possible, or a service-principal PAT.' },
95
+ { key: 'waitTimeout', label: 'Statement wait timeout', type: 'text', placeholder: '50s' },
96
+ { key: 'byteLimit', label: 'Inline byte limit', type: 'number', placeholder: '25000000' },
97
+ ],
98
+ },
99
+ ];
100
+ export function getConnectorFormSchemas() {
101
+ return schemas;
102
+ }
103
+ //# sourceMappingURL=connector-forms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connector-forms.js","sourceRoot":"","sources":["../src/connector-forms.ts"],"names":[],"mappings":"AAoBA,MAAM,OAAO,GAA0B;IACrC;QACE,MAAM,EAAE,QAAQ;QAChB,KAAK,EAAE,QAAQ;QACf,QAAQ,EAAE,OAAO;QACjB,WAAW,EAAE,mDAAmD;QAChE,MAAM,EAAE;YACN,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,oBAAoB,EAAE,QAAQ,EAAE,IAAI,EAAE;SAChH;KACF;IACD;QACE,MAAM,EAAE,WAAW;QACnB,KAAK,EAAE,WAAW;QAClB,QAAQ,EAAE,WAAW;QACrB,WAAW,EAAE,mDAAmD;QAChE,MAAM,EAAE;YACN,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;YAClE,EAAE,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;YACtE,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;YACpE,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAA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ACP,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE;oBACzC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE;iBAChD;aACF;YACD,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,8EAA8E,EAAE;YACnK,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,wBAAwB,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE;YACzF,EAAE,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,mBAAmB,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE;SAC1F;KACF;CACF,CAAC;AAEF,MAAM,UAAU,uBAAuB;IACrC,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,72 @@
1
+ import { type ProductDomainContext } from "@zlens/core";
2
+ export type NotebookCellType = "markdown" | "sql" | "dql" | "param" | "chart" | "pivot" | "single_value" | "filter" | "table" | "map" | "writeback" | "python" | "chat";
3
+ export interface NotebookMetadata extends ProductDomainContext {
4
+ title: string;
5
+ description?: string;
6
+ createdWith: 'dql';
7
+ template?: string;
8
+ }
9
+ export interface NotebookChartConfig {
10
+ sourceCellId?: string;
11
+ chart?: string;
12
+ x?: string;
13
+ y?: string;
14
+ y2?: string;
15
+ color?: string;
16
+ title?: string;
17
+ }
18
+ export interface NotebookCell {
19
+ id: string;
20
+ type: NotebookCellType;
21
+ title?: string;
22
+ source: string;
23
+ config?: NotebookChartConfig;
24
+ executionTarget?: {
25
+ target: "connection" | "local";
26
+ connectionName?: string;
27
+ };
28
+ datasetRefs?: Array<{
29
+ id: string;
30
+ alias?: string;
31
+ role?: "source" | "staged" | "output";
32
+ fingerprint?: string;
33
+ }>;
34
+ dependencies?: Array<{
35
+ cellId: string;
36
+ output?: string;
37
+ }>;
38
+ annotations?: Array<{
39
+ id: string;
40
+ body: string;
41
+ createdAt: string;
42
+ updatedAt?: string;
43
+ author?: string;
44
+ }>;
45
+ mixedSourcePlan?: {
46
+ datasetId?: string;
47
+ datasetName?: string;
48
+ localDataset: string;
49
+ localAlias: string;
50
+ localKey: string;
51
+ warehouseKey: string;
52
+ warehouseExpression: string;
53
+ warehouseSql: string;
54
+ warehouseRelations?: string[];
55
+ };
56
+ dqlArtifact?: Record<string, unknown>;
57
+ chatConfig?: Record<string, unknown>;
58
+ kernel?: Record<string, unknown>;
59
+ /** Future cell metadata is intentionally retained by the document reader. */
60
+ [key: string]: unknown;
61
+ }
62
+ export interface NotebookDocument {
63
+ dqlnbVersion: 2;
64
+ version: 1;
65
+ metadata: NotebookMetadata;
66
+ cells: NotebookCell[];
67
+ }
68
+ export declare function createNotebookDocument(title: string, cells: NotebookCell[], metadata?: Partial<NotebookMetadata>): NotebookDocument;
69
+ export declare function serializeNotebook(document: NotebookDocument): string;
70
+ export declare function deserializeNotebook(raw: string): NotebookDocument;
71
+ export declare function createWelcomeNotebook(template: string, projectTitle: string, driver?: string): NotebookDocument;
72
+ //# sourceMappingURL=document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../src/document.ts"],"names":[],"mappings":"AACA,OAAO,EAAiC,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEvF,MAAM,MAAM,gBAAgB,GACxB,UAAU,GACV,KAAK,GACL,KAAK,GACL,OAAO,GACP,OAAO,GACP,OAAO,GACP,cAAc,GACd,QAAQ,GACR,OAAO,GACP,KAAK,GACL,WAAW,GACX,QAAQ,GACR,MAAM,CAAC;AAEX,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB;IAC5D,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB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QACrB,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;QACrB,mBAAmB,EAAE,MAAM,CAAC;QAC5B,YAAY,EAAE,MAAM,CAAC;QACrB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;KAC/B,CAAC;IACF,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,6EAA6E;IAC7E,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,CAAC,CAAC;IAChB,OAAO,EAAE,CAAC,CAAC;IACX,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,KAAK,EAAE,YAAY,EAAE,CAAC;CACvB;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,YAAY,EAAE,EACrB,QAAQ,GAAE,OAAO,CAAC,gBAAgB,CAAM,GACvC,gBAAgB,CAYlB;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAmBpE;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAkCjE;AA4BD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAwE/G"}
@@ -0,0 +1,159 @@
1
+ import { canonicalizeNotebook } from "@zlens/core/format";
2
+ import { normalizeProductDomainContext } from "@zlens/core";
3
+ export function createNotebookDocument(title, cells, metadata = {}) {
4
+ return {
5
+ dqlnbVersion: 2,
6
+ version: 1,
7
+ metadata: {
8
+ title,
9
+ createdWith: 'dql',
10
+ ...metadata,
11
+ ...normalizeProductDomainContext(metadata),
12
+ },
13
+ cells,
14
+ };
15
+ }
16
+ export function serializeNotebook(document) {
17
+ const { title, ...metadata } = document.metadata;
18
+ return canonicalizeNotebook(JSON.stringify({
19
+ dqlnbVersion: 2,
20
+ version: 1,
21
+ title,
22
+ metadata,
23
+ cells: document.cells.map((cell) => {
24
+ const { source, title: cellTitle, config, ...rest } = cell;
25
+ return {
26
+ ...rest,
27
+ ...(cellTitle ? { name: cellTitle } : {}),
28
+ content: source,
29
+ ...(config ? { chartConfig: config } : {}),
30
+ };
31
+ }),
32
+ }));
33
+ }
34
+ export function deserializeNotebook(raw) {
35
+ const parsed = JSON.parse(raw);
36
+ const parsedRecord = parsed;
37
+ const documentTitle = parsed.metadata?.title ?? parsedRecord.title;
38
+ if (parsed.version !== 1 || !documentTitle || !Array.isArray(parsed.cells)) {
39
+ throw new Error("Invalid .dqlnb document.");
40
+ }
41
+ return {
42
+ dqlnbVersion: 2,
43
+ version: 1,
44
+ metadata: {
45
+ title: documentTitle,
46
+ description: parsed.metadata?.description,
47
+ createdWith: "dql",
48
+ template: parsed.metadata?.template,
49
+ ...normalizeProductDomainContext(parsed.metadata ?? {}, parsed.metadata?.ownerDomain),
50
+ },
51
+ cells: parsed.cells.map((cell, index) => {
52
+ const raw = cell;
53
+ return {
54
+ ...cell,
55
+ id: cell.id ?? `cell-${index + 1}`,
56
+ type: cell.type ?? "markdown",
57
+ title: cell.title ?? raw.name,
58
+ source: cell.source ?? raw.content ?? "",
59
+ config: cell.config ?? raw.chartConfig,
60
+ };
61
+ }),
62
+ };
63
+ }
64
+ function listTablesSQL(driver) {
65
+ if (!driver) {
66
+ return `SELECT 1 AS ready;`;
67
+ }
68
+ switch (driver.toLowerCase()) {
69
+ case 'duckdb':
70
+ case 'sqlite':
71
+ case 'file':
72
+ return `SHOW TABLES;`;
73
+ case 'postgresql':
74
+ case 'redshift':
75
+ return `SELECT table_schema, table_name FROM information_schema.tables\nWHERE table_schema NOT IN ('information_schema', 'pg_catalog')\nORDER BY table_schema, table_name LIMIT 20;`;
76
+ case 'mysql':
77
+ return `SELECT table_schema, table_name FROM information_schema.tables\nWHERE table_schema NOT IN ('information_schema', 'mysql', 'performance_schema', 'sys')\nORDER BY table_schema, table_name LIMIT 20;`;
78
+ case 'snowflake':
79
+ case 'mssql':
80
+ case 'databricks':
81
+ case 'trino':
82
+ case 'fabric':
83
+ return `SELECT table_schema, table_name FROM information_schema.tables\nWHERE table_schema NOT IN ('INFORMATION_SCHEMA')\nORDER BY table_schema, table_name LIMIT 20;`;
84
+ default:
85
+ return `SELECT table_schema, table_name FROM information_schema.tables\nLIMIT 20;`;
86
+ }
87
+ }
88
+ export function createWelcomeNotebook(template, projectTitle, driver) {
89
+ const normalized = template.toLowerCase();
90
+ const showTablesQuery = listTablesSQL(driver);
91
+ if (normalized === 'dbt') {
92
+ return createNotebookDocument(`${projectTitle} - ZLens Workbench`, [
93
+ {
94
+ id: 'intro',
95
+ type: 'markdown',
96
+ title: 'Welcome',
97
+ source: `# ${projectTitle}\n\nZLens is governed analytics written in DQL (**Domain Query Language**), its query language. DQL is the domain layer that turns dbt models, SQL, metrics, notebooks, dashboards, apps, and business definitions into one trusted analytics project.\n\n**Core path:** source data -> dbt model -> DQL block -> business_view -> dashboard/app/AI answer.\n\nThis notebook is your workbench. Explore the dbt-backed database below, then promote useful queries into blocks and business views so the compiler can write \`dql-manifest.json\` with both technical lineage and business lineage.`,
98
+ },
99
+ {
100
+ id: 'sql-tables',
101
+ type: 'sql',
102
+ title: 'Available Tables',
103
+ source: `-- List tables in your database\n${showTablesQuery}`,
104
+ },
105
+ {
106
+ id: 'sql-explore',
107
+ type: 'sql',
108
+ title: 'Explore Your Data',
109
+ source: `-- Replace 'your_table' with a table name from the results above\n-- SELECT * FROM your_table LIMIT 20;`,
110
+ },
111
+ {
112
+ id: 'dql-example',
113
+ type: 'dql',
114
+ title: 'Example Domain Layer',
115
+ source: `term "Customer" {\n domain = "Customer"\n type = "entity"\n status = "draft"\n description = "A person or account that can place orders or receive service."\n owner = "customer-analytics"\n identifiers = ["customer_id"]\n}\n\nblock "Example Customer Rollup" {\n domain = "Customer"\n type = "custom"\n status = "draft"\n description = "Starter customer summary block. Replace this query with a dbt model query."\n owner = "analytics"\n terms = ["Customer"]\n businessOutcome = "Understand customer value and activity."\n decisionUse = "Account planning and retention review."\n\n query = """\n SELECT 1 AS customer_count\n """\n\n tests {\n assert row_count == 1\n }\n}\n\nbusiness_view "Customer 360" {\n domain = "Customer"\n status = "draft"\n description = "Business composition for account review and customer health."\n owner = "customer-analytics"\n terms = ["Customer"]\n businessOutcome = "See customer identity, value, activity, and service risk in one lineage path."\n decisionUse = "Account planning, churn review, and expansion targeting."\n reviewCadence = "weekly"\n\n includes {\n block "Example Customer Rollup"\n }\n}`,
116
+ },
117
+ {
118
+ id: 'next-steps',
119
+ type: 'markdown',
120
+ title: 'Next Steps',
121
+ source: `## Next steps\n\n1. Query a dbt model and save the useful logic as a DQL block.\n2. Add business terms under \`terms/\` for the vocabulary stakeholders use.\n3. Compose blocks into \`business_view\` files under \`business-views/\`.\n4. Run \`zlens compile .\` to refresh \`dql-manifest.json\`.\n5. Open Lineage to trace source -> model -> block -> business view -> consumption.`,
122
+ },
123
+ ], { description: 'ZLens workbench for turning a dbt project into business lineage.', template: 'dbt' });
124
+ }
125
+ // Default notebook for non-dbt projects
126
+ return createNotebookDocument(`${projectTitle} - ZLens Workbench`, [
127
+ {
128
+ id: 'intro',
129
+ type: 'markdown',
130
+ title: 'Welcome',
131
+ source: `# ${projectTitle}\n\nZLens is governed analytics written in DQL (**Domain Query Language**), its query language. Together they turn SQL, business terms, notebooks, dashboards, apps, and lineage into one trusted analytics project.\n\n**Core path:** source data -> DQL block -> business_view -> dashboard/app/AI answer.\n\nThis notebook is your workbench. Start with a table or local file, promote useful SQL into a block, then compose blocks into business views so the compiler can write \`dql-manifest.json\` with both technical lineage and business lineage.`,
132
+ },
133
+ {
134
+ id: 'sql-tables',
135
+ type: 'sql',
136
+ title: 'Available Tables',
137
+ source: `-- List tables in your database\n${showTablesQuery}`,
138
+ },
139
+ {
140
+ id: 'sql-starter',
141
+ type: 'sql',
142
+ title: 'Starter Query',
143
+ source: `-- Write your SQL here after connecting a warehouse or local DuckDB/file source\n-- Example: SELECT * FROM analytics.customers LIMIT 10;`,
144
+ },
145
+ {
146
+ id: 'dql-example',
147
+ type: 'dql',
148
+ title: 'Example Domain Layer',
149
+ source: `term "Customer" {\n domain = "Customer"\n type = "entity"\n status = "draft"\n description = "A person or account that can place orders or receive service."\n owner = "customer-analytics"\n identifiers = ["customer_id"]\n}\n\nblock "Example Customer Rollup" {\n domain = "Customer"\n type = "custom"\n status = "draft"\n description = "Starter customer summary block. Replace this query with your own source table."\n owner = "analytics"\n terms = ["Customer"]\n businessOutcome = "Understand customer value and activity."\n decisionUse = "Account planning and retention review."\n\n query = """\n SELECT 1 AS customer_count\n """\n\n tests {\n assert row_count == 1\n }\n}\n\nbusiness_view "Customer 360" {\n domain = "Customer"\n status = "draft"\n description = "Business composition for account review and customer health."\n owner = "customer-analytics"\n terms = ["Customer"]\n businessOutcome = "See customer identity, value, activity, and service risk in one lineage path."\n decisionUse = "Account planning, churn review, and expansion targeting."\n reviewCadence = "weekly"\n\n includes {\n block "Example Customer Rollup"\n }\n}`,
150
+ },
151
+ {
152
+ id: 'next-steps',
153
+ type: 'markdown',
154
+ title: 'Next Steps',
155
+ source: `## Next steps\n\n1. Add data by connecting a warehouse or adding a local DuckDB/file source.\n2. Save repeated SQL as DQL blocks under \`blocks/\`.\n3. Add business terms under \`terms/\` for shared vocabulary.\n4. Compose blocks into \`business_view\` files under \`business-views/\`.\n5. Run \`zlens compile .\` and open Lineage to inspect the business and technical path.`,
156
+ },
157
+ ], { description: 'DQL workbench for building a domain-first analytics project.', template: 'default' });
158
+ }
159
+ //# sourceMappingURL=document.js.map
@@ -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EAAE,EAAE,aAAa;gBACjB,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,sBAAsB;gBAC7B,MAAM,EAAE,spCAAspC;aAC/pC;YACD;gBACE,EAAE,EAAE,YAAY;gBAChB,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,YAAY;gBACnB,MAAM,EAAE,2XAA2X;aACpY;SACF,EAAE,EAAE,WAAW,EAAE,kEAAkE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3G,CAAC;IAED,wCAAwC;IACxC,OAAO,sBAAsB,CAAC,GAAG,YAAY,oBAAoB,EAAE;QACjE;YACE,EAAE,EAAE,OAAO;YACX,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,SAAS;YAChB,MAAM,EAAE,KAAK,YAAY,+hBAA+hB;SACzjB;QACD;YACE,EAAE,EAAE,YAAY;YAChB,IAAI,EAAE,KAAK;YACX,KAAK,EAAE,kBAAkB;YACzB,MAAM,EAAE,oCAAoC,eAAe,EAAE;SAC9D;QACD;YACE,EAAE,EAAE,aAAa;YACjB,IAAI,EAAE,KAAK;YACX,KAAK,EAAE,eAAe;YACtB,MAAM,EAAE,0IAA0I;SACnJ;QACD;YACE,EAAE,EAAE,aAAa;YACjB,IAAI,EAAE,KAAK;YACX,KAAK,EAAE,sBAAsB;YAC7B,MAAM,EAAE,0pCAA0pC;SACnqC;QACD;YACE,EAAE,EAAE,YAAY;YAChB,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,YAAY;YACnB,MAAM,EAAE,wXAAwX;SACjY;KACF,EAAE,EAAE,WAAW,EAAE,8DAA8D,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;AAC3G,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { type SemanticLayer } from '@zlens/core';
2
+ import type { SQLParamSpec } from '@zlens/connectors';
3
+ import type { NotebookCell, NotebookChartConfig } from './document.js';
4
+ export interface NotebookExecutionPlan {
5
+ title: string;
6
+ sql: string;
7
+ sqlParams: SQLParamSpec[];
8
+ variables: Record<string, unknown>;
9
+ chartConfig?: NotebookChartConfig;
10
+ tests: Array<{
11
+ field: string;
12
+ operator: string;
13
+ expected: unknown;
14
+ }>;
15
+ }
16
+ export interface BuildExecutionPlanOptions {
17
+ semanticLayer?: SemanticLayer;
18
+ /**
19
+ * SQL compiled by the already-selected semantic adapter. When present it is
20
+ * authoritative; notebook planning only adds chart, parameter, variable, and
21
+ * test metadata and must not try a second native semantic compilation.
22
+ */
23
+ semanticSql?: string;
24
+ /** Driver name for SQL dialect selection (e.g. 'snowflake', 'bigquery'). */
25
+ driver?: string;
26
+ /** Maps semantic table names to actual database table names, e.g. order_items -> dev.order_items. */
27
+ tableMapping?: Record<string, string>;
28
+ /** Resolved typed values from the shared block invocation contract. */
29
+ parameters?: Record<string, unknown>;
30
+ }
31
+ export declare function buildExecutionPlan(cell: NotebookCell, options?: BuildExecutionPlanOptions): NotebookExecutionPlan | null;
32
+ //# sourceMappingURL=execute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../src/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGvE,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,KAAK,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CACtE;AAED,MAAM,WAAW,yBAAyB;IACxC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qGAAqG;IACrG,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,uEAAuE;IACvE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,YAAY,EAClB,OAAO,CAAC,EAAE,yBAAyB,GAClC,qBAAqB,GAAG,IAAI,CA+E9B"}