zenstack 2.19.0 → 2.19.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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publisher": "zenstack",
4
4
  "displayName": "ZenStack Language Tools",
5
5
  "description": "FullStack enhancement for Prisma ORM: seamless integration from database to UI",
6
- "version": "2.19.0",
6
+ "version": "2.19.1",
7
7
  "author": {
8
8
  "name": "ZenStack Team"
9
9
  },
@@ -78,6 +78,11 @@
78
78
  "command": "zenstack.preview-zmodel",
79
79
  "when": "editorLangId == zmodel",
80
80
  "group": "navigation"
81
+ },
82
+ {
83
+ "command": "zenstack.save-zmodel-documentation",
84
+ "when": "(activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor') && zenstack.isMarkdownPreview == true",
85
+ "group": "navigation"
81
86
  }
82
87
  ],
83
88
  "commandPalette": [
@@ -99,6 +104,11 @@
99
104
  "title": "ZenStack: Preview ZModel Documentation",
100
105
  "icon": "$(preview)"
101
106
  },
107
+ {
108
+ "command": "zenstack.save-zmodel-documentation",
109
+ "title": "ZenStack: Save ZModel Documentation",
110
+ "icon": "$(save)"
111
+ },
102
112
  {
103
113
  "command": "zenstack.clear-documentation-cache",
104
114
  "title": "ZenStack: Clear Documentation Cache",
@@ -116,6 +126,12 @@
116
126
  "key": "ctrl+shift+v",
117
127
  "mac": "cmd+shift+v",
118
128
  "when": "editorLangId == zmodel"
129
+ },
130
+ {
131
+ "command": "zenstack.save-zmodel-documentation",
132
+ "key": "ctrl+shift+s",
133
+ "mac": "cmd+shift+s",
134
+ "when": "(activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor') && zenstack.isMarkdownPreview == true"
119
135
  }
120
136
  ]
121
137
  },
@@ -153,8 +169,8 @@
153
169
  "vscode-languageserver-textdocument": "^1.0.7",
154
170
  "vscode-uri": "^3.0.6",
155
171
  "zod-validation-error": "^4.0.0",
156
- "@zenstackhq/sdk": "2.19.0",
157
- "@zenstackhq/language": "2.19.0"
172
+ "@zenstackhq/language": "2.19.1",
173
+ "@zenstackhq/sdk": "2.19.1"
158
174
  },
159
175
  "peerDependencies": {
160
176
  "prisma": "5.0.0 - 6.16.x",
@@ -176,7 +192,7 @@
176
192
  "tmp": "^0.2.1",
177
193
  "tsc-alias": "^1.7.0",
178
194
  "vitest": "^0.29.7",
179
- "@zenstackhq/runtime": "2.19.0"
195
+ "@zenstackhq/runtime": "2.19.1"
180
196
  },
181
197
  "scripts": {
182
198
  "vscode:publish": "vsce publish --no-dependencies",
@@ -1,48 +0,0 @@
1
- import * as vscode from 'vscode';
2
- /**
3
- * DocumentationCache class handles persistent caching of ZModel documentation
4
- * using VS Code's globalState for cross-session persistence
5
- */
6
- export declare class DocumentationCache implements vscode.Disposable {
7
- private static readonly CACHE_DURATION_MS;
8
- private static readonly CACHE_PREFIX;
9
- private extensionContext;
10
- private extensionVersion;
11
- constructor(context: vscode.ExtensionContext);
12
- /**
13
- * Dispose of the cache resources (implements vscode.Disposable)
14
- */
15
- dispose(): void;
16
- /**
17
- * Get the cache prefix used for keys
18
- */
19
- getCachePrefix(): string;
20
- /**
21
- * Enable cache synchronization across machines via VS Code Settings Sync
22
- */
23
- private enableCacheSync;
24
- /**
25
- * Generate a cache key from request body with normalized content
26
- */
27
- private generateCacheKey;
28
- /**
29
- * Check if cache entry is still valid (not expired)
30
- */
31
- private isCacheValid;
32
- /**
33
- * Get cached response if available and valid
34
- */
35
- getCachedResponse(models: string[]): Promise<string | null>;
36
- /**
37
- * Cache a response for future use
38
- */
39
- setCachedResponse(models: string[], data: string): Promise<void>;
40
- /**
41
- * Clear expired cache entries from persistent storage
42
- */
43
- clearExpiredCache(): Promise<void>;
44
- /**
45
- * Clear all cache entries from persistent storage
46
- */
47
- clearAllCache(): Promise<void>;
48
- }
@@ -1,141 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.DocumentationCache = void 0;
13
- const crypto_1 = require("crypto");
14
- /**
15
- * DocumentationCache class handles persistent caching of ZModel documentation
16
- * using VS Code's globalState for cross-session persistence
17
- */
18
- class DocumentationCache {
19
- constructor(context) {
20
- this.extensionContext = context;
21
- this.extensionVersion = context.extension.packageJSON.version;
22
- // clear expired cache entries on initialization
23
- this.clearExpiredCache();
24
- }
25
- /**
26
- * Dispose of the cache resources (implements vscode.Disposable)
27
- */
28
- dispose() { }
29
- /**
30
- * Get the cache prefix used for keys
31
- */
32
- getCachePrefix() {
33
- return DocumentationCache.CACHE_PREFIX;
34
- }
35
- /**
36
- * Enable cache synchronization across machines via VS Code Settings Sync
37
- */
38
- enableCacheSync() {
39
- const cacheKeys = this.extensionContext.globalState
40
- .keys()
41
- .filter((key) => key.startsWith(DocumentationCache.CACHE_PREFIX));
42
- if (cacheKeys.length > 0) {
43
- this.extensionContext.globalState.setKeysForSync(cacheKeys);
44
- }
45
- }
46
- /**
47
- * Generate a cache key from request body with normalized content
48
- */
49
- generateCacheKey(models) {
50
- // Remove ALL whitespace characters from each model string for cache key generation
51
- // This ensures identical content with different formatting uses the same cache
52
- const normalizedModels = models.map((model) => model.replace(/\s/g, '')).sort();
53
- const hash = (0, crypto_1.createHash)('sha512')
54
- .update(JSON.stringify({ models: normalizedModels }))
55
- .digest('hex');
56
- return `${DocumentationCache.CACHE_PREFIX}${hash}`;
57
- }
58
- /**
59
- * Check if cache entry is still valid (not expired)
60
- */
61
- isCacheValid(entry) {
62
- return Date.now() - entry.timestamp < DocumentationCache.CACHE_DURATION_MS;
63
- }
64
- /**
65
- * Get cached response if available and valid
66
- */
67
- getCachedResponse(models) {
68
- return __awaiter(this, void 0, void 0, function* () {
69
- const cacheKey = this.generateCacheKey(models);
70
- const entry = this.extensionContext.globalState.get(cacheKey);
71
- if (entry && this.isCacheValid(entry)) {
72
- console.log('Using cached documentation response from persistent storage');
73
- return entry.data;
74
- }
75
- // Clean up expired entry if it exists
76
- if (entry) {
77
- yield this.extensionContext.globalState.update(cacheKey, undefined);
78
- }
79
- return null;
80
- });
81
- }
82
- /**
83
- * Cache a response for future use
84
- */
85
- setCachedResponse(models, data) {
86
- return __awaiter(this, void 0, void 0, function* () {
87
- const cacheKey = this.generateCacheKey(models);
88
- const cacheEntry = {
89
- data,
90
- timestamp: Date.now(),
91
- extensionVersion: this.extensionVersion,
92
- };
93
- yield this.extensionContext.globalState.update(cacheKey, cacheEntry);
94
- // Update sync keys to include new cache entry
95
- this.enableCacheSync();
96
- });
97
- }
98
- /**
99
- * Clear expired cache entries from persistent storage
100
- */
101
- clearExpiredCache() {
102
- return __awaiter(this, void 0, void 0, function* () {
103
- const now = Date.now();
104
- let clearedCount = 0;
105
- const allKeys = this.extensionContext.globalState.keys();
106
- for (const key of allKeys) {
107
- if (key.startsWith(DocumentationCache.CACHE_PREFIX)) {
108
- const entry = this.extensionContext.globalState.get(key);
109
- if ((entry === null || entry === void 0 ? void 0 : entry.extensionVersion) !== this.extensionVersion ||
110
- now - entry.timestamp >= DocumentationCache.CACHE_DURATION_MS) {
111
- yield this.extensionContext.globalState.update(key, undefined);
112
- clearedCount++;
113
- }
114
- }
115
- }
116
- if (clearedCount > 0) {
117
- console.log(`Cleared ${clearedCount} expired cache entries from persistent storage`);
118
- }
119
- });
120
- }
121
- /**
122
- * Clear all cache entries from persistent storage
123
- */
124
- clearAllCache() {
125
- return __awaiter(this, void 0, void 0, function* () {
126
- const allKeys = this.extensionContext.globalState.keys();
127
- let clearedCount = 0;
128
- for (const key of allKeys) {
129
- if (key.startsWith(DocumentationCache.CACHE_PREFIX)) {
130
- yield this.extensionContext.globalState.update(key, undefined);
131
- clearedCount++;
132
- }
133
- }
134
- console.log(`Cleared all cache entries from persistent storage (${clearedCount} items)`);
135
- });
136
- }
137
- }
138
- exports.DocumentationCache = DocumentationCache;
139
- DocumentationCache.CACHE_DURATION_MS = 30 * 24 * 60 * 60 * 1000; // 30 days cache duration
140
- DocumentationCache.CACHE_PREFIX = 'doc-cache.';
141
- //# sourceMappingURL=documentation-cache.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"documentation-cache.js","sourceRoot":"","sources":["../src/documentation-cache.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,mCAAoC;AASpC;;;GAGG;AACH,MAAa,kBAAkB;IAO3B,YAAY,OAAgC;QACxC,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC;QAChC,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,OAAiB,CAAC;QACxE,gDAAgD;QAChD,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,OAAO,KAAU,CAAC;IAElB;;OAEG;IACH,cAAc;QACV,OAAO,kBAAkB,CAAC,YAAY,CAAC;IAC3C,CAAC;IAED;;OAEG;IACK,eAAe;QACnB,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW;aAC9C,IAAI,EAAE;aACN,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC,CAAC;QACtE,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QAChE,CAAC;IACL,CAAC;IAED;;OAEG;IACK,gBAAgB,CAA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AA;IAED;;OAEG;IACG,aAAa;;YACf,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;YACzD,IAAI,YAAY,GAAG,CAAC,CAAC;YAErB,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;gBACxB,IAAI,GAAG,CAAC,UAAU,CAAC,kBAAkB,CAAC,YAAY,CAAC,EAAE,CAAC;oBAClD,MAAM,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;oBAC/D,YAAY,EAAE,CAAC;gBACnB,CAAC;YACL,CAAC;YAED,OAAO,CAAC,GAAG,CAAC,sDAAsD,YAAY,SAAS,CAAC,CAAC;QAC7F,CAAC;KAAA;;AAxIL,gDAyIC;AAxI2B,oCAAiB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,yBAAyB;AACvE,+BAAY,GAAG,YAAY,CAAC"}
package/extension.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import * as vscode from 'vscode';
2
- export declare function requireAuth(): Promise<vscode.AuthenticationSession | undefined>;
3
- export declare function activate(context: vscode.ExtensionContext): void;
4
- export declare function deactivate(): Thenable<void> | undefined;
package/extension.js DELETED
@@ -1,135 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
- return new (P || (P = Promise))(function (resolve, reject) {
38
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
- step((generator = generator.apply(thisArg, _arguments || [])).next());
42
- });
43
- };
44
- Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.requireAuth = requireAuth;
46
- exports.activate = activate;
47
- exports.deactivate = deactivate;
48
- const vscode = __importStar(require("vscode"));
49
- const path = __importStar(require("path"));
50
- const node_1 = require("vscode-languageclient/node");
51
- const zenstack_auth_provider_1 = require("./zenstack-auth-provider");
52
- const documentation_cache_1 = require("./documentation-cache");
53
- const zmodel_preview_1 = require("./zmodel-preview");
54
- const release_notes_manager_1 = require("./release-notes-manager");
55
- // Global variables
56
- let client;
57
- // Utility to require authentication when needed
58
- function requireAuth() {
59
- return __awaiter(this, void 0, void 0, function* () {
60
- let session;
61
- session = yield vscode.authentication.getSession(zenstack_auth_provider_1.AUTH_PROVIDER_ID, [], { createIfNone: false });
62
- if (!session) {
63
- const signIn = 'Sign in';
64
- const selection = yield vscode.window.showWarningMessage('Please sign in to use this feature', signIn);
65
- if (selection === signIn) {
66
- try {
67
- session = yield vscode.authentication.getSession(zenstack_auth_provider_1.AUTH_PROVIDER_ID, [], { createIfNone: true });
68
- if (session) {
69
- vscode.window.showInformationMessage('ZenStack sign-in successful!');
70
- }
71
- }
72
- catch (e) {
73
- vscode.window.showErrorMessage('ZenStack sign-in failed: ' + (e instanceof Error ? e.message : String(e)));
74
- }
75
- }
76
- }
77
- return session;
78
- });
79
- }
80
- // This function is called when the extension is activated.
81
- function activate(context) {
82
- // Initialize and register the ZenStack authentication provider
83
- context.subscriptions.push(new zenstack_auth_provider_1.ZenStackAuthenticationProvider(context));
84
- // Start language client
85
- client = startLanguageClient(context);
86
- const documentationCache = new documentation_cache_1.DocumentationCache(context);
87
- context.subscriptions.push(documentationCache);
88
- context.subscriptions.push(new zmodel_preview_1.ZModelPreview(context, client, documentationCache));
89
- context.subscriptions.push(new release_notes_manager_1.ReleaseNotesManager(context));
90
- }
91
- // This function is called when the extension is deactivated.
92
- function deactivate() {
93
- if (client) {
94
- return client.stop();
95
- }
96
- return undefined;
97
- }
98
- function startLanguageClient(context) {
99
- const serverModule = context.asAbsolutePath(path.join('bundle', 'language-server', 'main'));
100
- // The debug options for the server
101
- // --inspect=6009: runs the server in Node's Inspector mode so VS Code can attach to the server for debugging.
102
- // By setting `process.env.DEBUG_BREAK` to a truthy value, the language server will wait until a debugger is attached.
103
- const debugOptions = {
104
- execArgv: [
105
- '--nolazy',
106
- `--inspect${process.env.DEBUG_BREAK ? '-brk' : ''}=${process.env.DEBUG_SOCKET || '6009'}`,
107
- ],
108
- };
109
- // If the extension is launched in debug mode then the debug server options are used
110
- // Otherwise the run options are used
111
- const serverOptions = {
112
- run: { module: serverModule, transport: node_1.TransportKind.ipc },
113
- debug: {
114
- module: serverModule,
115
- transport: node_1.TransportKind.ipc,
116
- options: debugOptions,
117
- },
118
- };
119
- const fileSystemWatcher = vscode.workspace.createFileSystemWatcher('**/*.zmodel');
120
- context.subscriptions.push(fileSystemWatcher);
121
- // Options to control the language client
122
- const clientOptions = {
123
- documentSelector: [{ scheme: 'file', language: 'zmodel' }],
124
- synchronize: {
125
- // Notify the server about file changes to files contained in the workspace
126
- fileEvents: fileSystemWatcher,
127
- },
128
- };
129
- // Create the language client and start the client.
130
- const client = new node_1.LanguageClient('zmodel', 'ZenStack Model', serverOptions, clientOptions);
131
- // Start the client. This will also launch the server
132
- void client.start();
133
- return client;
134
- }
135
- //# sourceMappingURL=extension.js.map
package/extension.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"extension.js","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,kCAsBC;AAGD,4BAWC;AAGD,gCAKC;AAzDD,+CAAiC;AACjC,2CAA6B;AAE7B,qDAAiH;AACjH,qEAA4F;AAC5F,+DAA2D;AAC3D,qDAAiD;AACjD,mEAA8D;AAE9D,mBAAmB;AACnB,IAAI,MAAsB,CAAC;AAE3B,gDAAgD;AAChD,SAAsB,WAAW;;QAC7B,IAAI,OAAiD,CAAC;QAEtD,OAAO,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,yCAAgB,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;QAEhG,IAAI,CAAC,OAAO,EAAE,CAAC;YACX,MAAM,MAAM,GAAG,SAAS,CAAC;YACzB,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,oCAAoC,EAAE,MAAM,CAAC,CAAC;YACvG,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;gBACvB,IAAI,CAAC;oBACD,OAAO,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,yCAAgB,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;oBAC/F,IAAI,O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AAE,MAAM,CAAC,CAAC,CAAC;IAC5F,mCAAmC;IACnC,8GAA8G;IAC9G,sHAAsH;IACtH,MAAM,YAAY,GAAG;QACjB,QAAQ,EAAE;YACN,UAAU;YACV,YAAY,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,MAAM,EAAE;SAC5F;KACJ,CAAC;IAEF,oFAAoF;IACpF,qCAAqC;IACrC,MAAM,aAAa,GAAkB;QACjC,GAAG,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,oBAAa,CAAC,GAAG,EAAE;QAC3D,KAAK,EAAE;YACH,MAAM,EAAE,YAAY;YACpB,SAAS,EAAE,oBAAa,CAAC,GAAG;YAC5B,OAAO,EAAE,YAAY;SACxB;KACJ,CAAC;IAEF,MAAM,iBAAiB,GAAG,MAAM,CAAC,SAAS,CAAC,uBAAuB,CAAC,aAAa,CAAC,CAAC;IAClF,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAE9C,yCAAyC;IACzC,MAAM,aAAa,GAA0B;QACzC,gBAAgB,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;QAC1D,WAAW,EAAE;YACT,2EAA2E;YAC3E,UAAU,EAAE,iBAAiB;SAChC;KACJ,CAAC;IAEF,mDAAmD;IACnD,MAAM,MAAM,GAAG,IAAI,qBAAc,CAAC,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;IAE5F,qDAAqD;IACrD,KAAK,MAAM,CAAC,KAAK,EAAE,CAAC;IACpB,OAAO,MAAM,CAAC;AAClB,CAAC"}
@@ -1,25 +0,0 @@
1
- import * as vscode from 'vscode';
2
- /**
3
- * ReleaseNotesManager class handles release notes functionality
4
- */
5
- export declare class ReleaseNotesManager implements vscode.Disposable {
6
- private extensionContext;
7
- private readonly zmodelPreviewReleaseNoteKey;
8
- constructor(context: vscode.ExtensionContext);
9
- /**
10
- * Initialize and register commands, show release notes if first time
11
- */
12
- initialize(): void;
13
- /**
14
- * Show release notes on first activation of this version
15
- */
16
- showReleaseNotesIfFirstTime(): Promise<void>;
17
- /**
18
- * Show release notes (can be called manually)
19
- */
20
- showReleaseNotes(): Promise<void>;
21
- /**
22
- * Dispose of resources
23
- */
24
- dispose(): void;
25
- }
@@ -1,111 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
- return new (P || (P = Promise))(function (resolve, reject) {
38
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
- step((generator = generator.apply(thisArg, _arguments || [])).next());
42
- });
43
- };
44
- Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.ReleaseNotesManager = void 0;
46
- const vscode = __importStar(require("vscode"));
47
- /**
48
- * ReleaseNotesManager class handles release notes functionality
49
- */
50
- class ReleaseNotesManager {
51
- constructor(context) {
52
- this.zmodelPreviewReleaseNoteKey = 'zmodel-preview-release-note-shown';
53
- this.extensionContext = context;
54
- this.initialize();
55
- }
56
- /**
57
- * Initialize and register commands, show release notes if first time
58
- */
59
- initialize() {
60
- this.showReleaseNotesIfFirstTime();
61
- }
62
- /**
63
- * Show release notes on first activation of this version
64
- */
65
- showReleaseNotesIfFirstTime() {
66
- return __awaiter(this, void 0, void 0, function* () {
67
- // Show release notes if this is the first time activating this version
68
- if (!this.extensionContext.globalState.get(this.zmodelPreviewReleaseNoteKey)) {
69
- yield this.showReleaseNotes();
70
- // Update the stored version to prevent showing again
71
- yield this.extensionContext.globalState.update(this.zmodelPreviewReleaseNoteKey, true);
72
- // Add this key to sync keys for cross-machine synchronization
73
- this.extensionContext.globalState.setKeysForSync([this.zmodelPreviewReleaseNoteKey]);
74
- }
75
- });
76
- }
77
- /**
78
- * Show release notes (can be called manually)
79
- */
80
- showReleaseNotes() {
81
- return __awaiter(this, void 0, void 0, function* () {
82
- try {
83
- // Read the release notes HTML file
84
- const releaseNotesPath = vscode.Uri.joinPath(this.extensionContext.extensionUri, 'bundle/res/zmodel-preview-release-notes.html');
85
- const htmlBytes = yield vscode.workspace.fs.readFile(releaseNotesPath);
86
- const htmlContent = Buffer.from(htmlBytes).toString('utf8');
87
- // Create and show the release notes webview
88
- const panel = vscode.window.createWebviewPanel('ZenstackReleaseNotes', 'ZenStack - New Feature Announcement!', vscode.ViewColumn.One, {
89
- enableScripts: true,
90
- retainContextWhenHidden: true,
91
- });
92
- panel.webview.html = htmlContent;
93
- // Optional: Close the panel when user clicks outside or after some time
94
- panel.onDidDispose(() => {
95
- // Panel disposed
96
- });
97
- }
98
- catch (error) {
99
- console.error('Error showing release notes:', error);
100
- }
101
- });
102
- }
103
- /**
104
- * Dispose of resources
105
- */
106
- dispose() {
107
- // Any cleanup if needed
108
- }
109
- }
110
- exports.ReleaseNotesManager = ReleaseNotesManager;
111
- //# sourceMappingURL=release-notes-manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"release-notes-manager.js","sourceRoot":"","sources":["../src/release-notes-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAEjC;;GAEG;AACH,MAAa,mBAAmB;IAI5B,YAAY,OAAgC;QAF3B,gCAA2B,GAAG,mCAAmC,CAAC;QAG/E,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC;QAChC,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,UAAU;QACN,IAAI,CAAC,2BAA2B,EAAE,CAAC;IACvC,CAAC;IAED;;OAEG;IACG,2BAA2B;;YAC7B,uEAAuE;YACvE,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,2BAA2B,CAAC,EAAE,CAAC;gBAC3E,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBAC9B,qDAAqD;gBACrD,MAAM,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE,IAAI,CAAC,CAAC;gBACvF,8DAA8D;gBAC9D,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC,CAAC;YACzF,CAAC;QACL,CAAC;KAAA;IAED;;OAEG;IACG,gBAAgB;;YAClB,IAAI,CAAC;gBACD,mCAAmC;gBACnC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CACxC,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAClC,8CAA8C,CACjD,CAAC;gBAEF,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;gBACvE,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;gBAC5D,4CAA4C;gBAC5C,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAC1C,sBAAsB,EACtB,sCAAsC,EACtC,MAAM,CAAC,UAAU,CAAC,GAAG,EACrB;oBACI,aAAa,EAAE,IAAI;oBACnB,uBAAuB,EAAE,IAAI;iBAChC,CACJ,CAAC;gBAEF,KAAK,CAAC,OAAO,CAAC,IAAI,GAAG,WAAW,CAAC;gBAEjC,wEAAwE;gBACxE,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE;oBACpB,iBAAiB;gBACrB,CAAC,CAAC,CAAC;YACP,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC;YACzD,CAAC;QACL,CAAC;KAAA;IAED;;OAEG;IACH,OAAO;QACH,wBAAwB;IAC5B,CAAC;CACJ;AAvED,kDAuEC"}
@@ -1,91 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <link href="https://cdn.jsdelivr.net/npm/@vscode/codicons@0.0.40/dist/codicon.min.css" rel="stylesheet" />
5
-
6
- <style>
7
- body {
8
- font-family: system-ui, -apple-system, sans-serif;
9
- padding: 20px;
10
- max-width: 800px;
11
- margin: 0 auto;
12
- background-color: var(--vscode-editor-background);
13
- color: var(--vscode-editor-foreground);
14
- }
15
- .header {
16
- background-color: var(--vscode-button-background);
17
- color: var(--vscode-button-foreground);
18
- padding: 20px;
19
- border-radius: 8px;
20
- text-align: center;
21
- margin-bottom: 20px;
22
- }
23
- .feature {
24
- background-color: var(--vscode-textBlockQuote-background);
25
- border: 1px solid var(--vscode-textBlockQuote-border);
26
- padding: 15px;
27
- border-radius: 6px;
28
- margin: 15px 0;
29
- border-left: 4px solid var(--vscode-button-background);
30
- }
31
- .steps {
32
- background-color: var(--vscode-textCodeBlock-background);
33
- padding: 15px;
34
- border-radius: 6px;
35
- margin: 15px 0;
36
- }
37
- a {
38
- color: var(--vscode-textLink-foreground);
39
- text-decoration: none;
40
- }
41
- a:hover {
42
- text-decoration: underline;
43
- color: var(--vscode-textLink-activeForeground);
44
- }
45
- </style>
46
- </head>
47
- <body>
48
- <div class="header">
49
- <h1>🎉 Introducing ZModel Documentation Preview</h1>
50
- <p>Preview documentation directly from your ZModel powered by AI</p>
51
- </div>
52
-
53
- <div class="feature">
54
- <h3>📖 What's New</h3>
55
- <p>
56
- You can now preview comprehensive documentation for your ZModel files, just like you would preview a
57
- markdown file.
58
- </p>
59
- </div>
60
-
61
- <div class="steps">
62
- <h3>🚀 How to Use</h3>
63
- <ol>
64
- <li>Open your <code>.zmodel</code> file</li>
65
- <li>
66
- Click (<span class="codicon codicon-preview"></span>) in the editor toolbar, or simply press
67
- <code>Cmd&nbsp;+&nbsp;Shift&nbsp;+&nbsp;V</code> (Mac) or
68
- <code>Ctrl&nbsp;+&nbsp;Shift&nbsp;+&nbsp;V</code> (Windows)
69
- </li>
70
- <li>Sign in with ZenStack (one-time setup)</li>
71
- <li>Enjoy your AI-generated documentation</li>
72
- </ol>
73
- </div>
74
-
75
- <div class="steps">
76
- <h3>💡 Tips</h3>
77
- <ul>
78
- <li>Ensure your zmodel is error-free before generating.</li>
79
- <li>Use your main zmodel file, which will include all imported models, for complete documentation.</li>
80
- <li>
81
- Add clear, descriptive comments in your ZModel. The more context you provide, the better the
82
- results.
83
- </li>
84
- </ul>
85
- </div>
86
-
87
- <p style="text-align: center; color: var(--vscode-descriptionForeground); margin-top: 30px">
88
- Happy coding with ZenStack! 🚀<br />
89
- </p>
90
- </body>
91
- </html>