jitsu-cli 1.9.0 → 1.9.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.
@@ -1,44 +1,44 @@
1
- jitsu-cli:build: cache hit, replaying output 9a4f1f023c0bbd89
2
- jitsu-cli:build: 
3
- jitsu-cli:build: > jitsu-cli@0.0.0 build /Users/vklmn/dev2/newjitsu/cli/jitsu-cli
4
- jitsu-cli:build: > pnpm compile && webpack
5
- jitsu-cli:build: 
6
- jitsu-cli:build: 
7
- jitsu-cli:build: > jitsu-cli@0.0.0 compile /Users/vklmn/dev2/newjitsu/cli/jitsu-cli
8
- jitsu-cli:build: > tsc -p .
9
- jitsu-cli:build: 
10
- jitsu-cli:build: asset main.js 12.4 MiB [emitted] (name: main) 1 related asset
11
- jitsu-cli:build: asset 230.js 130 KiB [emitted] (id hint: vendors) 1 related asset
12
- jitsu-cli:build: asset 10546bf325e211cf9719.js 36.9 KiB [emitted] [immutable] [from: ../../node_modules/.pnpm/@rollup+plugin-typescript@11.1.3_rollup@3.29.1_tslib@2.6.2_typescript@5.3.3/node_modules/@rollup/plugin-typescript/dist/es/index.js] (auxiliary name: main)
13
- jitsu-cli:build: asset 718.js 10 KiB [emitted] 1 related asset
14
- jitsu-cli:build: orphan modules 568 KiB [orphan] 97 modules
15
- jitsu-cli:build: runtime modules 3.62 KiB 10 modules
16
- jitsu-cli:build: cacheable modules 11.7 MiB (javascript) 36.9 KiB (asset)
17
- jitsu-cli:build:  javascript modules 11.4 MiB 607 modules
18
- jitsu-cli:build:  json modules 363 KiB
19
- jitsu-cli:build:  modules by path ../../node_modules/.pnpm/iconv-lite@0.4.24/node_modules/iconv-lite/ 86.7 KiB 8 modules
20
- jitsu-cli:build:  + 4 modules
21
- jitsu-cli:build:  ../../node_modules/.pnpm/@rollup+plugin-typescript@11.1.3_rollup@3.29.1_tslib@2....(truncated) 42 bytes (javascript) 36.9 KiB (asset) [built] [code generated]
22
- jitsu-cli:build: optional modules 286 bytes [optional]
23
- jitsu-cli:build:  external "perf_hooks" 42 bytes [optional] [built] [code generated]
24
- jitsu-cli:build:  ../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/ sync 160 bytes [optional] [built] [code generated]
25
- jitsu-cli:build:  external "worker_threads" 42 bytes [optional] [built] [code generated]
26
- jitsu-cli:build:  external "node:stream/web" 42 bytes [optional] [built] [code generated]
27
- jitsu-cli:build: + 27 modules
28
- jitsu-cli:build: 
29
- jitsu-cli:build: WARNING in ../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/typescript.js 3071:22-44
30
- jitsu-cli:build: Critical dependency: the request of a dependency is an expression
31
- jitsu-cli:build:  @ ../../node_modules/.pnpm/@rollup+plugin-typescript@11.1.3_rollup@3.29.1_tslib@2.6.2_typescript@5.3.3/node_modules/@rollup/plugin-typescript/dist/es/index.js 4:0-38 108:34-46 226:59-71 488:23-35 597:31-43
32
- jitsu-cli:build:  @ ./src/commands/build.ts 14:0-51 61:27-37
33
- jitsu-cli:build:  @ ./src/index.ts 6:0-41 16:166-171
34
- jitsu-cli:build: 
35
- jitsu-cli:build: WARNING in ../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/typescript.js 6260:35-54
36
- jitsu-cli:build: Critical dependency: the request of a dependency is an expression
37
- jitsu-cli:build:  @ ../../node_modules/.pnpm/@rollup+plugin-typescript@11.1.3_rollup@3.29.1_tslib@2.6.2_typescript@5.3.3/node_modules/@rollup/plugin-typescript/dist/es/index.js 4:0-38 108:34-46 226:59-71 488:23-35 597:31-43
38
- jitsu-cli:build:  @ ./src/commands/build.ts 14:0-51 61:27-37
39
- jitsu-cli:build:  @ ./src/index.ts 6:0-41 16:166-171
40
- jitsu-cli:build: 
41
- jitsu-cli:build: 2 warnings have detailed information that is not shown.
42
- jitsu-cli:build: Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.
43
- jitsu-cli:build: 
44
- jitsu-cli:build: webpack 5.88.2 compiled with 2 warnings in 4316 ms
1
+ jitsu-cli:build: cache hit, replaying output 945e18ca4f505ebd
2
+ jitsu-cli:build: 
3
+ jitsu-cli:build: > jitsu-cli@0.0.0 build /Users/ildarnurislamov/Projects/newjitsu/cli/jitsu-cli
4
+ jitsu-cli:build: > pnpm compile && webpack
5
+ jitsu-cli:build: 
6
+ jitsu-cli:build: 
7
+ jitsu-cli:build: > jitsu-cli@0.0.0 compile /Users/ildarnurislamov/Projects/newjitsu/cli/jitsu-cli
8
+ jitsu-cli:build: > tsc -p .
9
+ jitsu-cli:build: 
10
+ jitsu-cli:build: asset main.js 12.4 MiB [emitted] (name: main) 1 related asset
11
+ jitsu-cli:build: asset 230.js 130 KiB [emitted] (id hint: vendors) 1 related asset
12
+ jitsu-cli:build: asset 10546bf325e211cf9719.js 36.9 KiB [emitted] [immutable] [from: ../../node_modules/.pnpm/@rollup+plugin-typescript@11.1.3_rollup@3.29.1_tslib@2.6.2_typescript@5.3.3/node_modules/@rollup/plugin-typescript/dist/es/index.js] (auxiliary name: main)
13
+ jitsu-cli:build: asset 718.js 10 KiB [emitted] 1 related asset
14
+ jitsu-cli:build: orphan modules 568 KiB [orphan] 97 modules
15
+ jitsu-cli:build: runtime modules 3.62 KiB 10 modules
16
+ jitsu-cli:build: cacheable modules 11.7 MiB (javascript) 36.9 KiB (asset)
17
+ jitsu-cli:build:  javascript modules 11.4 MiB 607 modules
18
+ jitsu-cli:build:  json modules 363 KiB
19
+ jitsu-cli:build:  modules by path ../../node_modules/.pnpm/iconv-lite@0.4.24/node_modules/iconv-lite/ 86.7 KiB 8 modules
20
+ jitsu-cli:build:  + 4 modules
21
+ jitsu-cli:build:  ../../node_modules/.pnpm/@rollup+plugin-typescript@11.1.3_rollup@3.29.1_tslib@2....(truncated) 42 bytes (javascript) 36.9 KiB (asset) [built] [code generated]
22
+ jitsu-cli:build: optional modules 286 bytes [optional]
23
+ jitsu-cli:build:  external "perf_hooks" 42 bytes [optional] [built] [code generated]
24
+ jitsu-cli:build:  ../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/ sync 160 bytes [optional] [built] [code generated]
25
+ jitsu-cli:build:  external "worker_threads" 42 bytes [optional] [built] [code generated]
26
+ jitsu-cli:build:  external "node:stream/web" 42 bytes [optional] [built] [code generated]
27
+ jitsu-cli:build: + 27 modules
28
+ jitsu-cli:build: 
29
+ jitsu-cli:build: WARNING in ../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/typescript.js 3071:22-44
30
+ jitsu-cli:build: Critical dependency: the request of a dependency is an expression
31
+ jitsu-cli:build:  @ ../../node_modules/.pnpm/@rollup+plugin-typescript@11.1.3_rollup@3.29.1_tslib@2.6.2_typescript@5.3.3/node_modules/@rollup/plugin-typescript/dist/es/index.js 4:0-38 108:34-46 226:59-71 488:23-35 597:31-43
32
+ jitsu-cli:build:  @ ./src/commands/build.ts 14:0-51 61:27-37
33
+ jitsu-cli:build:  @ ./src/index.ts 6:0-41 16:166-171
34
+ jitsu-cli:build: 
35
+ jitsu-cli:build: WARNING in ../../node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/typescript.js 6260:35-54
36
+ jitsu-cli:build: Critical dependency: the request of a dependency is an expression
37
+ jitsu-cli:build:  @ ../../node_modules/.pnpm/@rollup+plugin-typescript@11.1.3_rollup@3.29.1_tslib@2.6.2_typescript@5.3.3/node_modules/@rollup/plugin-typescript/dist/es/index.js 4:0-38 108:34-46 226:59-71 488:23-35 597:31-43
38
+ jitsu-cli:build:  @ ./src/commands/build.ts 14:0-51 61:27-37
39
+ jitsu-cli:build:  @ ./src/index.ts 6:0-41 16:166-171
40
+ jitsu-cli:build: 
41
+ jitsu-cli:build: 2 warnings have detailed information that is not shown.
42
+ jitsu-cli:build: Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.
43
+ jitsu-cli:build: 
44
+ jitsu-cli:build: webpack 5.88.2 compiled with 2 warnings in 5827 ms
@@ -1,5 +1,5 @@
1
- jitsu-cli:clean: cache hit, replaying output c8bf5d956b1b59d0
2
- jitsu-cli:clean: 
3
- jitsu-cli:clean: > jitsu-cli@0.0.0 clean /Users/vklmn/dev2/newjitsu/cli/jitsu-cli
4
- jitsu-cli:clean: > rm -rf ./dist
5
- jitsu-cli:clean: 
1
+ jitsu-cli:clean: cache hit, replaying output 77969978ab78c57c
2
+ jitsu-cli:clean: 
3
+ jitsu-cli:clean: > jitsu-cli@0.0.0 clean /Users/ildarnurislamov/Projects/newjitsu/cli/jitsu-cli
4
+ jitsu-cli:clean: > rm -rf ./dist
5
+ jitsu-cli:clean: 
@@ -0,0 +1,239 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.extensionProjectTemplate = exports.packageJsonTemplate = void 0;
4
+ const version_1 = require("../lib/version");
5
+ const index_1 = require("../index");
6
+ const packageJsonTemplate = ({ packageName, type, jitsuVersion = undefined }) => {
7
+ const res = {
8
+ name: `${packageName}`,
9
+ version: "0.0.1",
10
+ description: `Jitsu ${type} - ${packageName}`,
11
+ keywords: ["jitsu", "extension", `jitsu-${type}-extension`],
12
+ main: `dist/${packageName}.js`,
13
+ scripts: {
14
+ clean: "rm -rf ./dist",
15
+ build: `${index_1.binName} extension build`,
16
+ test: `${index_1.binName} extension test`,
17
+ execute: `${index_1.binName} extension exec`,
18
+ },
19
+ devDependencies: {
20
+ "@jitsu/types": `${jitsuVersion || "^" + version_1.jitsuCliVersion}`,
21
+ "@jitsu/jlib": `${jitsuVersion || "^" + version_1.jitsuCliVersion}`,
22
+ "ts-jest": "^27.0.7",
23
+ [index_1.binName]: `${jitsuVersion || "^" + version_1.jitsuCliVersion}`,
24
+ tslib: "^2.3.1",
25
+ typescript: "^4.5.2",
26
+ },
27
+ dependencies: {},
28
+ };
29
+ if (type === "destination" || type === "source") {
30
+ res.scripts["validate-config"] = `${index_1.binName} extension validate-config`;
31
+ }
32
+ return res;
33
+ };
34
+ exports.packageJsonTemplate = packageJsonTemplate;
35
+ let destinationTest = ({ type = "destination" }) => {
36
+ if (type !== "destination") {
37
+ return undefined;
38
+ }
39
+ return `
40
+ import { JitsuDestinationContext } from "@jitsu/types/extension"
41
+ import { testDestination } from "${index_1.binName}/lib/tests"
42
+ import { destination } from "../src"
43
+
44
+ testDestination({
45
+ name: "basic",
46
+ context: {
47
+ destinationId: "test",
48
+ destinationType: "mydest",
49
+ config: {}
50
+ },
51
+ destination: destination,
52
+ event: {
53
+ event_type: 'test',
54
+ a: 1
55
+ },
56
+ expectedResult: {
57
+ method: "POST",
58
+ url: "https://test.com",
59
+ body: { a: 2 },
60
+ },
61
+ })
62
+ `;
63
+ };
64
+ let destinationCode = () => {
65
+ return `
66
+ import { DestinationFunction, DestinationMessage, JitsuDestinationContext, ConfigValidator} from "@jitsu/types/extension";
67
+ import { DefaultJitsuEvent } from "@jitsu/types/event";
68
+
69
+ export type DestinationConfig = {
70
+ exampleParam: string
71
+ }
72
+
73
+ export const validator: ConfigValidator<DestinationConfig> = async (config: DestinationConfig) => {
74
+ if (config.exampleParam !== 'valid-config') {
75
+ return \`Invalid config: exampleParam expected to be 'valid-config', but actual value is: \${config.exampleParam}\`;
76
+ }
77
+ return true;
78
+ }
79
+
80
+ export const destination: DestinationFunction = (event: DefaultJitsuEvent, dstContext: JitsuDestinationContext<DestinationConfig>) => {
81
+ return { url: "https://test.com", method: "POST", body: { a: (event.a || 0) + 1 } };
82
+ };
83
+ `;
84
+ };
85
+ let sourceCode = () => {
86
+ return `
87
+ import { SourceCatalog, StateService, StreamReader, StreamSink, StreamConfiguration } from "@jitsu/types/sources";
88
+ import { ConfigValidationResult, ExtensionDescriptor } from "@jitsu/types/extension";
89
+
90
+ export interface SourceConfig {
91
+ user_id: string
92
+ my_source_param: string;
93
+ }
94
+
95
+ export interface StreamConfig {
96
+ my_stream_param: string;
97
+ }
98
+
99
+ async function validator(config: SourceConfig): Promise<ConfigValidationResult> {
100
+ //TODO: Check that provided config data allows to connect to third party API
101
+ console.log("validator is not yet implemented");
102
+ return true;
103
+ }
104
+
105
+ const descriptor: ExtensionDescriptor<SourceConfig> = {
106
+ id: "my_source",
107
+ displayName: "Source Example",
108
+ description:
109
+ "Example source that produces row with run number and source/stream configuration.",
110
+ configurationParameters: [
111
+ {
112
+ displayName: "User ID",
113
+ id: "user_id",
114
+ type: "string",
115
+ required: true,
116
+ documentation: "User Id",
117
+ },
118
+ {
119
+ displayName: "Example Parameter",
120
+ id: "my_source_param",
121
+ required: true,
122
+ type: "string",
123
+ documentation: \`
124
+ <div>
125
+ Example Parameter
126
+ </div>
127
+ \`,
128
+ }
129
+ ],
130
+ };
131
+
132
+ const sourceCatalog: SourceCatalog<SourceConfig, StreamConfig> = async config => {
133
+ return [
134
+ {
135
+ type: "my_source_runs",
136
+ supportedModes: ["incremental"],
137
+ params: [
138
+ {
139
+ id: "my_stream_param",
140
+ displayName: "Stream Parameter",
141
+ type: "string",
142
+ documentation: \`
143
+ <div>
144
+ Stream Parameter example.
145
+ </div>
146
+ \`,
147
+ required: true,
148
+ },
149
+ ]
150
+ }
151
+ ];
152
+ };
153
+
154
+ const streamReader: StreamReader<SourceConfig, StreamConfig> = async (
155
+ sourceConfig: SourceConfig,
156
+ streamType: string,
157
+ streamConfiguration: StreamConfiguration<StreamConfig>,
158
+ streamSink: StreamSink,
159
+ services: { state: StateService }
160
+ ) => {
161
+ //Example of saved state usage. Read previous run number:
162
+ let runNumber = services.state.get("run_number") || 0;
163
+ runNumber++
164
+ streamSink.log("INFO", "Run number: " + runNumber);
165
+ streamSink.addRecord({
166
+ $id: runNumber,
167
+ $recordTimestamp: new Date(),
168
+ type: streamType,
169
+ ...sourceConfig,
170
+ ...streamConfiguration.parameters
171
+ });
172
+ //Save last run number to state
173
+ services.state.set("run_number", runNumber);
174
+ };
175
+
176
+ export { streamReader, sourceCatalog, descriptor, validator };
177
+ `;
178
+ };
179
+ let transformCode = () => {
180
+ return `
181
+ import {TransformationFunction} from "@jitsu/types/extension";
182
+ import {DefaultJitsuEvent} from "@jitsu/types/event";
183
+
184
+ //duplicate events
185
+ const transform: TransformationFunction = (event: DefaultJitsuEvent) => {
186
+ return [event, {...event, eventn_ctx_event_id: event.eventn_ctx_event_id + "_2"}]
187
+ }
188
+
189
+ export default transform;
190
+ `;
191
+ };
192
+ let descriptor = {};
193
+ descriptor["destination"] = (vars) => `
194
+ import {ExtensionDescriptor} from "@jitsu/types/extension";
195
+ import {destination, validator, DestinationConfig} from "./destination";
196
+
197
+ const descriptor: ExtensionDescriptor = {
198
+ id: "${vars.packageName}",
199
+ displayName: "${vars.packageName}",
200
+ icon: "",
201
+ description: "Jitsu destination - ${vars.packageName} (generated by \`${index_1.binName} extension create\`)",
202
+ configurationParameters: [
203
+ {id: "exampleParam", type: "string", required: true, displayName: "Example param", documentation: "Documentation"}
204
+ ],
205
+ };
206
+
207
+ export { descriptor, destination, validator };
208
+ `;
209
+ descriptor["transform"] = (vars) => `
210
+ import {ExtensionDescriptor} from "@jitsu/types/extension";
211
+ import transform from "./transform";
212
+
213
+ const descriptor: ExtensionDescriptor = {
214
+ id: "${vars.packageName}",
215
+ displayName: "${vars.packageName}",
216
+ icon: "",
217
+ description: "Jitsu ${vars.type} - ${vars.packageName} (generated by \`${index_1.binName} extension create)\`"
218
+ }
219
+
220
+ export {descriptor, transform}
221
+ `;
222
+ exports.extensionProjectTemplate = {
223
+ "__test__/destination.test.ts": destinationTest,
224
+ "src/destination.ts": vars => vars.type == "destination" && destinationCode(),
225
+ "src/transform.ts": vars => vars.type == "transform" && transformCode(),
226
+ "src/index.ts": vars => (vars.type == "source" ? sourceCode() : descriptor[vars.type](vars)),
227
+ "package.json": exports.packageJsonTemplate,
228
+ "tsconfig.json": {
229
+ compilerOptions: {
230
+ module: "ES2020",
231
+ target: "ES2021",
232
+ moduleResolution: "Node",
233
+ esModuleInterop: true,
234
+ outDir: "./dist",
235
+ rootDir: "./",
236
+ },
237
+ include: ["./src", "__test__"],
238
+ },
239
+ };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.appendError = void 0;
4
+ function appendError(msg, cause) {
5
+ if (cause && cause.message) {
6
+ return `${msg}: ${cause.message}`;
7
+ }
8
+ else if (cause && typeof cause === "string") {
9
+ return `${msg}: ${cause}`;
10
+ }
11
+ else if (cause) {
12
+ return `${msg}: ${cause.toString()}`;
13
+ }
14
+ else {
15
+ return msg;
16
+ }
17
+ }
18
+ exports.appendError = appendError;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
5
+ function log0(delegate, styling, msg, args) {
6
+ if (!msg) {
7
+ delegate("");
8
+ return;
9
+ }
10
+ let consoleMsg = chalk_1.default[styling.color](`[${styling.prefix}]`) + " - " + msg;
11
+ if (args.length > 0) {
12
+ delegate(consoleMsg, args);
13
+ }
14
+ else {
15
+ delegate(consoleMsg);
16
+ }
17
+ }
18
+ function getLog() {
19
+ return {
20
+ error(msg, ...args) {
21
+ log0(console.error, { prefix: "error", color: "red" }, msg, args);
22
+ },
23
+ warn(msg, ...args) {
24
+ log0(console.warn, { prefix: "warn ", color: "yellow" }, msg, args);
25
+ },
26
+ spinInfo(args) { },
27
+ info(msg, ...args) {
28
+ log0(console.info, { prefix: "info ", color: "cyan" }, msg, args);
29
+ },
30
+ debug(msg, ...args) {
31
+ log0(console.debug, { prefix: "debug", color: "gray" }, msg, args);
32
+ },
33
+ };
34
+ }
35
+ const log = getLog();
36
+ exports.default = log;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RetryError = void 0;
4
+ const core_functions_1 = require("@jitsu/core-functions");
5
+ class RetryError extends Error {
6
+ constructor(message, options) {
7
+ super(message);
8
+ this.name = options?.drop ? `${core_functions_1.DropRetryErrorName}` : `${core_functions_1.RetryErrorName}`;
9
+ }
10
+ }
11
+ exports.RetryError = RetryError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jitsu-cli",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "description": "",
5
5
  "author": "Jitsu Dev Team <dev@jitsu.com>",
6
6
  "publishConfig": {
@@ -53,9 +53,9 @@
53
53
  "typescript": "^5.3.3",
54
54
  "webpack": "^5.88.2",
55
55
  "webpack-cli": "^5.1.4",
56
- "juava": "1.9.0",
57
- "@jitsu/functions-lib": "1.9.0",
58
- "@jitsu/protocols": "1.9.0"
56
+ "@jitsu/functions-lib": "1.9.1",
57
+ "juava": "1.9.1",
58
+ "@jitsu/protocols": "1.9.1"
59
59
  },
60
60
  "scripts": {
61
61
  "clean": "rm -rf ./dist",