@sw-tsdk/connector 2.0.1-next.41 → 2.0.1-next.44

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.
@@ -0,0 +1,16 @@
1
+ /// <reference types="node" />
2
+ import { Transform, TransformCallback, Writable } from 'node:stream';
3
+ /**
4
+ * Parse container action output from connector stdout stream
5
+ * @note Stdout is passed through while action output is written to another stream {@link ContainerStdoutActionOutputTransform.output}
6
+ */
7
+ export declare class ContainerStdoutActionOutputTransform extends Transform {
8
+ private output;
9
+ private nextToken;
10
+ private decoder;
11
+ private decodedBuffer;
12
+ constructor(output: Writable);
13
+ _transform(chunk: unknown, encoding: string, callback: TransformCallback): void;
14
+ _flush(callback: (error?: Error | null) => void): void;
15
+ private parse;
16
+ }
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContainerStdoutActionOutputTransform = void 0;
4
+ const node_stream_1 = require("node:stream");
5
+ const node_string_decoder_1 = require("node:string_decoder");
6
+ const OUTPUT_TOKEN = '::set-output ';
7
+ var TokenType;
8
+ (function (TokenType) {
9
+ TokenType["none"] = "none";
10
+ TokenType["startOfOutput"] = "startOfOutput";
11
+ TokenType["endOfOutput"] = "endOfOutput";
12
+ TokenType["linefeed"] = "linefeed";
13
+ })(TokenType || (TokenType = {}));
14
+ /**
15
+ * Parse container action output from connector stdout stream
16
+ * @note Stdout is passed through while action output is written to another stream {@link ContainerStdoutActionOutputTransform.output}
17
+ */
18
+ class ContainerStdoutActionOutputTransform extends node_stream_1.Transform {
19
+ constructor(output) {
20
+ super({ encoding: 'utf-8' });
21
+ this.output = output;
22
+ this.nextToken = TokenType.startOfOutput;
23
+ this.decodedBuffer = '';
24
+ this.decoder = new node_string_decoder_1.StringDecoder('utf-8');
25
+ }
26
+ _transform(chunk, encoding, callback) {
27
+ const chunkDecoded = Buffer.isBuffer(chunk) ? this.decoder.write(chunk) : chunk;
28
+ this.decodedBuffer += chunkDecoded;
29
+ this.parse();
30
+ callback();
31
+ }
32
+ _flush(callback) {
33
+ // flush any left over (incomplete) decoder data
34
+ this.decodedBuffer += this.decoder.end();
35
+ this.parse();
36
+ this.output.end();
37
+ callback();
38
+ }
39
+ parse() {
40
+ while (this.decodedBuffer.length > 0) {
41
+ if (this.nextToken === TokenType.startOfOutput) {
42
+ const token = OUTPUT_TOKEN.slice(0, Math.max(0, Math.min(OUTPUT_TOKEN.length, this.decodedBuffer.length)));
43
+ if (this.decodedBuffer.startsWith(token)) {
44
+ if (token.length === OUTPUT_TOKEN.length) {
45
+ // is a complete match for output token
46
+ // trim out token
47
+ this.decodedBuffer = this.decodedBuffer.slice(token.length);
48
+ // start looking for end of output
49
+ this.nextToken = TokenType.endOfOutput;
50
+ }
51
+ else {
52
+ // is a partial match for output token and needs more data
53
+ return;
54
+ }
55
+ }
56
+ else {
57
+ // was not a match
58
+ // look for line feed before starting over to look for output token again
59
+ this.nextToken = TokenType.linefeed;
60
+ }
61
+ }
62
+ if (this.nextToken === TokenType.none) {
63
+ // we are not looking for any tokens
64
+ // pass through
65
+ this.push(this.decodedBuffer, 'utf-8');
66
+ this.decodedBuffer = '';
67
+ }
68
+ else {
69
+ const lfIndex = this.decodedBuffer.indexOf('\n');
70
+ const data = lfIndex < 0 ? this.decodedBuffer : this.decodedBuffer.slice(0, Math.max(0, lfIndex + 1));
71
+ // trim out data
72
+ this.decodedBuffer = lfIndex < 0 ? '' : this.decodedBuffer.slice(Math.max(0, lfIndex + 1));
73
+ // pipe data to stream based on token
74
+ this.nextToken === TokenType.endOfOutput ? this.output.write(data) : this.push(data, 'utf-8');
75
+ if (lfIndex > -1) {
76
+ // next token to look for
77
+ this.nextToken = this.nextToken === TokenType.endOfOutput ? TokenType.none : TokenType.startOfOutput;
78
+ if (this.nextToken === TokenType.none) {
79
+ // we received all the action output so end its stream
80
+ this.output.end();
81
+ }
82
+ }
83
+ }
84
+ }
85
+ }
86
+ }
87
+ exports.ContainerStdoutActionOutputTransform = ContainerStdoutActionOutputTransform;
88
+ //# sourceMappingURL=container-stdout-action-output-transform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container-stdout-action-output-transform.js","sourceRoot":"","sources":["../src/container-stdout-action-output-transform.ts"],"names":[],"mappings":";;;AAAA,6CAAkE;AAClE,6DAAiD;AAEjD,MAAM,YAAY,GAAG,eAAe,CAAA;AAEpC,IAAK,SAKJ;AALD,WAAK,SAAS;IACZ,0BAAa,CAAA;IACb,4CAA+B,CAAA;IAC/B,wCAA2B,CAAA;IAC3B,kCAAqB,CAAA;AACvB,CAAC,EALI,SAAS,KAAT,SAAS,QAKb;AAED;;;GAGG;AACH,MAAa,oCAAqC,SAAQ,uBAAS;IAKjE,YAAoB,MAAgB;QAClC,KAAK,CAAC,EAAC,QAAQ,EAAE,OAAO,EAAC,CAAC,CAAA;QADR,WAAM,GAAN,MAAM,CAAU;QAJ5B,cAAS,GAAc,SAAS,CAAC,aAAa,CAAC;QAE/C,kBAAa,GAAW,EAAE,CAAC;QAIjC,IAAI,CAAC,OAAO,GAAG,IAAI,mCAAa,CAAC,OAAO,CAAC,CAAA;IAC3C,CAAC;IAED,UAAU,CAAC,KAAc,EAAE,QAAgB,EAAE,QAA2B;QACtE,MAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;QAC/E,IAAI,CAAC,aAAa,IAAI,YAAY,CAAA;QAClC,IAAI,CAAC,KAAK,EAAE,CAAA;QAEZ,QAAQ,EAAE,CAAA;IACZ,CAAC;IAED,MAAM,CAAC,QAAwC;QAC7C,gDAAgD;QAChD,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAA;QACxC,IAAI,CAAC,KAAK,EAAE,CAAA;QAEZ,IAAI,CAAC,MAAM,CAAC,GA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,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC,CAAA;gBAErG,gBAAgB;gBAChB,IAAI,CAAC,aAAa,GAAG,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC,CAAA;gBAE1F,qCAAqC;gBACrC,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;gBAE7F,IAAI,OAAO,GAAG,CAAC,CAAC,EAAE;oBAChB,yBAAyB;oBACzB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,aAAa,CAAA;oBAEpG,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,IAAI,EAAE;wBACrC,sDAAsD;wBACtD,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAA;qBAClB;iBACF;aACF;SACF;IACH,CAAC;CACF;AA5ED,oFA4EC"}
package/lib/index.d.ts CHANGED
@@ -5,3 +5,4 @@ export * from './json-schema-generator';
5
5
  export * from './common';
6
6
  export * from './defaults';
7
7
  export * from './logo';
8
+ export * from './container-stdout-action-output-transform';
package/lib/index.js CHANGED
@@ -8,4 +8,5 @@ tslib_1.__exportStar(require("./json-schema-generator"), exports);
8
8
  tslib_1.__exportStar(require("./common"), exports);
9
9
  tslib_1.__exportStar(require("./defaults"), exports);
10
10
  tslib_1.__exportStar(require("./logo"), exports);
11
+ tslib_1.__exportStar(require("./container-stdout-action-output-transform"), exports);
11
12
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,kDAAuB;AACvB,sDAA2B;AAC3B,kDAAuB;AACvB,kEAAuC;AACvC,mDAAwB;AACxB,qDAA0B;AAC1B,iDAAsB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,kDAAuB;AACvB,sDAA2B;AAC3B,kDAAuB;AACvB,kEAAuC;AACvC,mDAAwB;AACxB,qDAA0B;AAC1B,iDAAsB;AACtB,qFAA0D"}
@@ -0,0 +1,27 @@
1
+ export declare type ImageConfig = {
2
+ Hostname: string;
3
+ Domainname: string;
4
+ User: string;
5
+ AttachStdin: boolean;
6
+ AttachStdout: boolean;
7
+ AttachStderr: boolean;
8
+ ExposedPorts: {
9
+ [p: string]: number;
10
+ };
11
+ Tty: boolean;
12
+ OpenStdin: boolean;
13
+ StdinOnce: boolean;
14
+ Env: string[];
15
+ Cmd: string[];
16
+ ArgsEscaped: boolean;
17
+ Image: string;
18
+ Volumes: {
19
+ [p: string]: Record<string, unknown>;
20
+ };
21
+ WorkingDir: string;
22
+ Entrypoint?: string | string[] | undefined;
23
+ OnBuild: any[];
24
+ Labels: {
25
+ [p: string]: string;
26
+ };
27
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=dockerode-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dockerode-types.js","sourceRoot":"","sources":["../../src/types/dockerode-types.ts"],"names":[],"mappings":""}
@@ -3,3 +3,4 @@ export * from './connector-build-results';
3
3
  export * from './conversion-results';
4
4
  export * from './connector-doc-types';
5
5
  export * from './common-types';
6
+ export * from './dockerode-types';
@@ -6,4 +6,5 @@ tslib_1.__exportStar(require("./connector-build-results"), exports);
6
6
  tslib_1.__exportStar(require("./conversion-results"), exports);
7
7
  tslib_1.__exportStar(require("./connector-doc-types"), exports);
8
8
  tslib_1.__exportStar(require("./common-types"), exports);
9
+ tslib_1.__exportStar(require("./dockerode-types"), exports);
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,oEAAyC;AACzC,oEAAyC;AACzC,+DAAoC;AACpC,gEAAqC;AACrC,yDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,oEAAyC;AACzC,oEAAyC;AACzC,+DAAoC;AACpC,gEAAqC;AACrC,yDAA8B;AAC9B,4DAAiC"}
package/package.json CHANGED
@@ -9,9 +9,9 @@
9
9
  "@oclif/core": "1.16.4",
10
10
  "@oclif/plugin-help": "5",
11
11
  "@oclif/plugin-plugins": "2.0.1",
12
- "@sw-tsdk/common": "^2.0.1-next.41+e3bd50c",
13
- "@sw-tsdk/core": "^2.0.1-next.41+e3bd50c",
14
- "@sw-tsdk/docker": "^2.0.1-next.41+e3bd50c",
12
+ "@sw-tsdk/common": "^2.0.1-next.44+e410fa1",
13
+ "@sw-tsdk/core": "^2.0.1-next.44+e410fa1",
14
+ "@sw-tsdk/docker": "^2.0.1-next.44+e410fa1",
15
15
  "@swimlane/connector-interfaces": "1.8.5-rc3",
16
16
  "@swimlane/cosign": "1.3.1",
17
17
  "@types/folder-hash": "4.0.1",
@@ -63,6 +63,6 @@
63
63
  "test": "echo \"Error: run tests from root\" && exit 1"
64
64
  },
65
65
  "types": "lib/index.d.ts",
66
- "version": "2.0.1-next.41+e3bd50c",
67
- "gitHead": "e3bd50c20ff86123b9133fa06bdb78b0edc1e49a"
66
+ "version": "2.0.1-next.44+e410fa1",
67
+ "gitHead": "e410fa11ed2857f3d01ccefc73fd791503ec5573"
68
68
  }