@xube/kit-destination 0.0.93 → 0.0.95

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/dist/confirm.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ConfirmationRequest } from "./generated";
2
1
  import { XubeLog } from "@xube/kit-log";
3
2
  import { XubeResponse } from "@xube/kit-request";
3
+ import { ConfirmationRequest } from "./schemas/confirmation-request";
4
4
  export declare const isConfirmation: (headers: Record<string, any>, body: Record<string, any>, log?: XubeLog) => boolean;
5
5
  export declare const confirmDestination: (confirmationRequest: ConfirmationRequest, log?: XubeLog) => Promise<XubeResponse<boolean>>;
package/dist/confirm.js CHANGED
@@ -1,17 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.confirmDestination = exports.isConfirmation = void 0;
4
- const generated_1 = require("./generated");
5
4
  const kit_constants_1 = require("@xube/kit-constants");
6
5
  const kit_log_1 = require("@xube/kit-log");
7
6
  const kit_request_1 = require("@xube/kit-request");
7
+ const headers_1 = require("./schemas/headers");
8
+ const confirmation_request_1 = require("./schemas/confirmation-request");
8
9
  const isConfirmation = (headers, body, log = kit_log_1.XubeLog.getInstance()) => {
9
10
  log.info("Checking if confirmation request");
10
11
  log.info(JSON.stringify(headers));
11
12
  log.info(JSON.stringify(body));
12
- return ((0, generated_1.isDestinationHeaders)(headers) &&
13
+ return ((0, headers_1.isDestinationHeaders)(headers) &&
13
14
  headers["x-amz-rules-engine-message-type"] === "DestinationConfirmation" &&
14
- (0, generated_1.isConfirmationRequest)(body));
15
+ (0, confirmation_request_1.isConfirmationRequest)(body));
15
16
  };
16
17
  exports.isConfirmation = isConfirmation;
17
18
  const confirmDestination = async (confirmationRequest, log = kit_log_1.XubeLog.getInstance()) => {
@@ -1,2 +1,4 @@
1
1
  import { z } from "zod";
2
2
  export declare const RulesEngineMessageTypesSchema: z.ZodUnion<[z.ZodLiteral<"DestinationConfirmation">, z.ZodString]>;
3
+ export type RulesEngineMessageTypes = z.infer<typeof RulesEngineMessageTypesSchema>;
4
+ export declare const isRulesEngineMessageTypes: (item: unknown) => item is RulesEngineMessageTypes;
package/dist/constants.js CHANGED
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RulesEngineMessageTypesSchema = void 0;
3
+ exports.isRulesEngineMessageTypes = exports.RulesEngineMessageTypesSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const confirmation_request_1 = require("./schemas/confirmation-request");
6
6
  exports.RulesEngineMessageTypesSchema = zod_1.z.union([
7
7
  zod_1.z.literal(confirmation_request_1.DestinationConfirmationMessageType),
8
8
  zod_1.z.string(), //Change to literal when more types are added
9
9
  ]);
10
+ const isRulesEngineMessageTypes = (item) => exports.RulesEngineMessageTypesSchema.safeParse(item).success;
11
+ exports.isRulesEngineMessageTypes = isRulesEngineMessageTypes;
package/dist/index.d.ts CHANGED
@@ -2,4 +2,3 @@ export * from "./schemas/confirmation-request";
2
2
  export * from "./schemas/headers";
3
3
  export * from "./constants";
4
4
  export * from "./confirm";
5
- export * from "./generated/index";
package/dist/index.js CHANGED
@@ -18,4 +18,3 @@ __exportStar(require("./schemas/confirmation-request"), exports);
18
18
  __exportStar(require("./schemas/headers"), exports);
19
19
  __exportStar(require("./constants"), exports);
20
20
  __exportStar(require("./confirm"), exports);
21
- __exportStar(require("./generated/index"), exports);
@@ -16,3 +16,5 @@ export declare const ConfirmationRequestSchema: z.ZodObject<{
16
16
  enableUrl: z.ZodString;
17
17
  messageType: z.ZodString;
18
18
  }, z.ZodTypeAny, "passthrough">>;
19
+ export type ConfirmationRequest = z.infer<typeof ConfirmationRequestSchema>;
20
+ export declare const isConfirmationRequest: (item: unknown) => item is ConfirmationRequest;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConfirmationRequestSchema = exports.DestinationConfirmationMessageType = void 0;
3
+ exports.isConfirmationRequest = exports.ConfirmationRequestSchema = exports.DestinationConfirmationMessageType = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.DestinationConfirmationMessageType = "DestinationConfirmation";
6
6
  exports.ConfirmationRequestSchema = zod_1.z.object({
@@ -9,3 +9,5 @@ exports.ConfirmationRequestSchema = zod_1.z.object({
9
9
  enableUrl: zod_1.z.string(),
10
10
  messageType: zod_1.z.string(),
11
11
  }).nonstrict();
12
+ const isConfirmationRequest = (item) => exports.ConfirmationRequestSchema.safeParse(item).success;
13
+ exports.isConfirmationRequest = isConfirmationRequest;
@@ -9,3 +9,5 @@ export declare const DestinationHeadersSchema: z.ZodObject<{
9
9
  "x-amz-rules-engine-message-type": z.ZodUnion<[z.ZodLiteral<"DestinationConfirmation">, z.ZodString]>;
10
10
  "x-amz-rules-engine-destination-arn": z.ZodString;
11
11
  }, z.ZodTypeAny, "passthrough">>;
12
+ export type DestinationHeaders = z.infer<typeof DestinationHeadersSchema>;
13
+ export declare const isDestinationHeaders: (item: unknown) => item is DestinationHeaders;
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DestinationHeadersSchema = void 0;
3
+ exports.isDestinationHeaders = exports.DestinationHeadersSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const constants_1 = require("../constants");
6
6
  exports.DestinationHeadersSchema = zod_1.z.object({
7
7
  "x-amz-rules-engine-message-type": constants_1.RulesEngineMessageTypesSchema,
8
8
  "x-amz-rules-engine-destination-arn": zod_1.z.string(),
9
9
  }).passthrough();
10
+ const isDestinationHeaders = (item) => exports.DestinationHeadersSchema.safeParse(item).success;
11
+ exports.isDestinationHeaders = isDestinationHeaders;
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "@xube/kit-destination",
3
- "version": "0.0.93",
3
+ "version": "0.0.95",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1",
8
- "generate": "npx ts-node src/generator.ts"
7
+ "test": "echo \"Error: no test specified\" && exit 1"
9
8
  },
10
9
  "repository": {
11
10
  "type": "git",
@@ -19,14 +18,14 @@
19
18
  "homepage": "https://github.com/XubeLtd/dev-kit#readme",
20
19
  "devDependencies": {
21
20
  "@types/node": "^22.5.4",
22
- "@xube/kit-build": "^0.0.93",
21
+ "@xube/kit-build": "^0.0.95",
23
22
  "ts-node": "^10.9.2",
24
23
  "typescript": "^5.6.2"
25
24
  },
26
25
  "dependencies": {
27
- "@xube/kit-constants": "^0.0.93",
28
- "@xube/kit-generator": "^0.0.93",
29
- "@xube/kit-log": "^0.0.93",
30
- "@xube/kit-request": "^0.0.93"
26
+ "@xube/kit-constants": "^0.0.95",
27
+ "@xube/kit-generator": "^0.0.95",
28
+ "@xube/kit-log": "^0.0.95",
29
+ "@xube/kit-request": "^0.0.95"
31
30
  }
32
31
  }
package/src/confirm.ts CHANGED
@@ -1,11 +1,9 @@
1
- import {
2
- ConfirmationRequest,
3
- isConfirmationRequest,
4
- isDestinationHeaders,
5
- } from "./generated";
1
+
6
2
  import { StatusCode } from "@xube/kit-constants";
7
3
  import { XubeLog } from "@xube/kit-log";
8
4
  import { XubeResponse } from "@xube/kit-request";
5
+ import { isDestinationHeaders } from "./schemas/headers";
6
+ import { ConfirmationRequest, isConfirmationRequest } from "./schemas/confirmation-request";
9
7
 
10
8
  export const isConfirmation = (
11
9
  headers: Record<string, any>,
package/src/constants.ts CHANGED
@@ -5,3 +5,8 @@ export const RulesEngineMessageTypesSchema = z.union([
5
5
  z.literal(DestinationConfirmationMessageType),
6
6
  z.string(), //Change to literal when more types are added
7
7
  ]);
8
+
9
+ export type RulesEngineMessageTypes = z.infer<typeof RulesEngineMessageTypesSchema>;
10
+
11
+ export const isRulesEngineMessageTypes = (item: unknown): item is RulesEngineMessageTypes =>
12
+ RulesEngineMessageTypesSchema.safeParse(item).success;
package/src/index.ts CHANGED
@@ -2,6 +2,4 @@ export * from "./schemas/confirmation-request";
2
2
  export * from "./schemas/headers";
3
3
 
4
4
  export * from "./constants"
5
- export * from "./confirm"
6
-
7
- export * from "./generated/index"
5
+ export * from "./confirm"
@@ -8,3 +8,8 @@ export const ConfirmationRequestSchema = z.object({
8
8
  enableUrl: z.string(),
9
9
  messageType: z.string(),
10
10
  }).nonstrict();
11
+
12
+ export type ConfirmationRequest = z.infer<typeof ConfirmationRequestSchema>;
13
+
14
+ export const isConfirmationRequest = (item: unknown): item is ConfirmationRequest =>
15
+ ConfirmationRequestSchema.safeParse(item).success;
@@ -5,3 +5,8 @@ export const DestinationHeadersSchema = z.object({
5
5
  "x-amz-rules-engine-message-type": RulesEngineMessageTypesSchema,
6
6
  "x-amz-rules-engine-destination-arn": z.string(),
7
7
  }).passthrough();
8
+
9
+ export type DestinationHeaders = z.infer<typeof DestinationHeadersSchema>;
10
+
11
+ export const isDestinationHeaders = (item: unknown): item is DestinationHeaders =>
12
+ DestinationHeadersSchema.safeParse(item).success;
@@ -1,4 +0,0 @@
1
- export { validate as validateDestinationHeaders } from './validators/destinationHeaders';
2
- export * from './types/destinationHeaders';
3
- export { validate as validateConfirmationRequest } from './validators/confirmationRequest';
4
- export * from './types/confirmationRequest';
@@ -1,23 +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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.validateConfirmationRequest = exports.validateDestinationHeaders = void 0;
18
- var destinationHeaders_1 = require("./validators/destinationHeaders");
19
- Object.defineProperty(exports, "validateDestinationHeaders", { enumerable: true, get: function () { return destinationHeaders_1.validate; } });
20
- __exportStar(require("./types/destinationHeaders"), exports);
21
- var confirmationRequest_1 = require("./validators/confirmationRequest");
22
- Object.defineProperty(exports, "validateConfirmationRequest", { enumerable: true, get: function () { return confirmationRequest_1.validate; } });
23
- __exportStar(require("./types/confirmationRequest"), exports);
@@ -1,14 +0,0 @@
1
- /**
2
- * I am a generated file.
3
- *
4
- * If you change me, you and other developers will be sad.
5
- *
6
- * #StayGeneratedStayHappy
7
- */
8
- export type ConfirmationRequest = {
9
- arn: string;
10
- confirmationToken: string;
11
- enableUrl: string;
12
- messageType: string;
13
- };
14
- export declare const isConfirmationRequest: (item: unknown) => item is ConfirmationRequest;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- /**
3
- * I am a generated file.
4
- *
5
- * If you change me, you and other developers will be sad.
6
- *
7
- * #StayGeneratedStayHappy
8
- */
9
- var __importDefault = (this && this.__importDefault) || function (mod) {
10
- return (mod && mod.__esModule) ? mod : { "default": mod };
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.isConfirmationRequest = void 0;
14
- const kit_log_1 = require("@xube/kit-log");
15
- const confirmationRequest_1 = __importDefault(require("../validators/confirmationRequest"));
16
- const isConfirmationRequest = (item) => {
17
- const isValid = (0, confirmationRequest_1.default)(item);
18
- if (!isValid) {
19
- kit_log_1.XubeLog.getInstance().info(JSON.stringify(confirmationRequest_1.default.errors, null, 2));
20
- }
21
- return isValid;
22
- };
23
- exports.isConfirmationRequest = isConfirmationRequest;
@@ -1,12 +0,0 @@
1
- /**
2
- * I am a generated file.
3
- *
4
- * If you change me, you and other developers will be sad.
5
- *
6
- * #StayGeneratedStayHappy
7
- */
8
- export type DestinationHeaders = {
9
- "x-amz-rules-engine-message-type": "DestinationConfirmation" | string;
10
- "x-amz-rules-engine-destination-arn": string;
11
- };
12
- export declare const isDestinationHeaders: (item: unknown) => item is DestinationHeaders;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- /**
3
- * I am a generated file.
4
- *
5
- * If you change me, you and other developers will be sad.
6
- *
7
- * #StayGeneratedStayHappy
8
- */
9
- var __importDefault = (this && this.__importDefault) || function (mod) {
10
- return (mod && mod.__esModule) ? mod : { "default": mod };
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.isDestinationHeaders = void 0;
14
- const kit_log_1 = require("@xube/kit-log");
15
- const destinationHeaders_1 = __importDefault(require("../validators/destinationHeaders"));
16
- const isDestinationHeaders = (item) => {
17
- const isValid = (0, destinationHeaders_1.default)(item);
18
- if (!isValid) {
19
- kit_log_1.XubeLog.getInstance().info(JSON.stringify(destinationHeaders_1.default.errors, null, 2));
20
- }
21
- return isValid;
22
- };
23
- exports.isDestinationHeaders = isDestinationHeaders;
@@ -1,112 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validate = void 0;
4
- exports.validate = validate10;
5
- exports.default = validate10;
6
- const schema27 = { "$ref": "#/definitions/confirmationrequestJsonSchema", "definitions": { "confirmationrequestJsonSchema": { "type": "object", "properties": { "arn": { "type": "string" }, "confirmationToken": { "type": "string" }, "enableUrl": { "type": "string" }, "messageType": { "type": "string" } }, "required": ["arn", "confirmationToken", "enableUrl", "messageType"], "additionalProperties": true } }, "$schema": "http://json-schema.org/draft-07/schema#" };
7
- const schema28 = { "type": "object", "properties": { "arn": { "type": "string" }, "confirmationToken": { "type": "string" }, "enableUrl": { "type": "string" }, "messageType": { "type": "string" } }, "required": ["arn", "confirmationToken", "enableUrl", "messageType"], "additionalProperties": true };
8
- function validate10(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (data && typeof data == "object" && !Array.isArray(data)) {
9
- if (data.arn === undefined) {
10
- const err0 = { instancePath, schemaPath: "#/definitions/confirmationrequestJsonSchema/required", keyword: "required", params: { missingProperty: "arn" }, message: "must have required property '" + "arn" + "'" };
11
- if (vErrors === null) {
12
- vErrors = [err0];
13
- }
14
- else {
15
- vErrors.push(err0);
16
- }
17
- errors++;
18
- }
19
- if (data.confirmationToken === undefined) {
20
- const err1 = { instancePath, schemaPath: "#/definitions/confirmationrequestJsonSchema/required", keyword: "required", params: { missingProperty: "confirmationToken" }, message: "must have required property '" + "confirmationToken" + "'" };
21
- if (vErrors === null) {
22
- vErrors = [err1];
23
- }
24
- else {
25
- vErrors.push(err1);
26
- }
27
- errors++;
28
- }
29
- if (data.enableUrl === undefined) {
30
- const err2 = { instancePath, schemaPath: "#/definitions/confirmationrequestJsonSchema/required", keyword: "required", params: { missingProperty: "enableUrl" }, message: "must have required property '" + "enableUrl" + "'" };
31
- if (vErrors === null) {
32
- vErrors = [err2];
33
- }
34
- else {
35
- vErrors.push(err2);
36
- }
37
- errors++;
38
- }
39
- if (data.messageType === undefined) {
40
- const err3 = { instancePath, schemaPath: "#/definitions/confirmationrequestJsonSchema/required", keyword: "required", params: { missingProperty: "messageType" }, message: "must have required property '" + "messageType" + "'" };
41
- if (vErrors === null) {
42
- vErrors = [err3];
43
- }
44
- else {
45
- vErrors.push(err3);
46
- }
47
- errors++;
48
- }
49
- for (const key0 in data) {
50
- if (!((((key0 === "arn") || (key0 === "confirmationToken")) || (key0 === "enableUrl")) || (key0 === "messageType"))) {
51
- delete data[key0];
52
- }
53
- }
54
- if (data.arn !== undefined) {
55
- if (typeof data.arn !== "string") {
56
- const err4 = { instancePath: instancePath + "/arn", schemaPath: "#/definitions/confirmationrequestJsonSchema/properties/arn/type", keyword: "type", params: { type: "string" }, message: "must be string" };
57
- if (vErrors === null) {
58
- vErrors = [err4];
59
- }
60
- else {
61
- vErrors.push(err4);
62
- }
63
- errors++;
64
- }
65
- }
66
- if (data.confirmationToken !== undefined) {
67
- if (typeof data.confirmationToken !== "string") {
68
- const err5 = { instancePath: instancePath + "/confirmationToken", schemaPath: "#/definitions/confirmationrequestJsonSchema/properties/confirmationToken/type", keyword: "type", params: { type: "string" }, message: "must be string" };
69
- if (vErrors === null) {
70
- vErrors = [err5];
71
- }
72
- else {
73
- vErrors.push(err5);
74
- }
75
- errors++;
76
- }
77
- }
78
- if (data.enableUrl !== undefined) {
79
- if (typeof data.enableUrl !== "string") {
80
- const err6 = { instancePath: instancePath + "/enableUrl", schemaPath: "#/definitions/confirmationrequestJsonSchema/properties/enableUrl/type", keyword: "type", params: { type: "string" }, message: "must be string" };
81
- if (vErrors === null) {
82
- vErrors = [err6];
83
- }
84
- else {
85
- vErrors.push(err6);
86
- }
87
- errors++;
88
- }
89
- }
90
- if (data.messageType !== undefined) {
91
- if (typeof data.messageType !== "string") {
92
- const err7 = { instancePath: instancePath + "/messageType", schemaPath: "#/definitions/confirmationrequestJsonSchema/properties/messageType/type", keyword: "type", params: { type: "string" }, message: "must be string" };
93
- if (vErrors === null) {
94
- vErrors = [err7];
95
- }
96
- else {
97
- vErrors.push(err7);
98
- }
99
- errors++;
100
- }
101
- }
102
- }
103
- else {
104
- const err8 = { instancePath, schemaPath: "#/definitions/confirmationrequestJsonSchema/type", keyword: "type", params: { type: "object" }, message: "must be object" };
105
- if (vErrors === null) {
106
- vErrors = [err8];
107
- }
108
- else {
109
- vErrors.push(err8);
110
- }
111
- errors++;
112
- } validate10.errors = vErrors; return errors === 0; }
@@ -1,120 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validate = void 0;
4
- exports.validate = validate10;
5
- exports.default = validate10;
6
- const schema27 = { "$ref": "#/definitions/destinationheadersJsonSchema", "definitions": { "destinationheadersJsonSchema": { "type": "object", "properties": { "x-amz-rules-engine-message-type": { "anyOf": [{ "type": "string", "const": "DestinationConfirmation" }, { "type": "string" }] }, "x-amz-rules-engine-destination-arn": { "type": "string" } }, "required": ["x-amz-rules-engine-message-type", "x-amz-rules-engine-destination-arn"], "additionalProperties": true } }, "$schema": "http://json-schema.org/draft-07/schema#" };
7
- const schema28 = { "type": "object", "properties": { "x-amz-rules-engine-message-type": { "anyOf": [{ "type": "string", "const": "DestinationConfirmation" }, { "type": "string" }] }, "x-amz-rules-engine-destination-arn": { "type": "string" } }, "required": ["x-amz-rules-engine-message-type", "x-amz-rules-engine-destination-arn"], "additionalProperties": true };
8
- function validate10(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (data && typeof data == "object" && !Array.isArray(data)) {
9
- if (data["x-amz-rules-engine-message-type"] === undefined) {
10
- const err0 = { instancePath, schemaPath: "#/definitions/destinationheadersJsonSchema/required", keyword: "required", params: { missingProperty: "x-amz-rules-engine-message-type" }, message: "must have required property '" + "x-amz-rules-engine-message-type" + "'" };
11
- if (vErrors === null) {
12
- vErrors = [err0];
13
- }
14
- else {
15
- vErrors.push(err0);
16
- }
17
- errors++;
18
- }
19
- if (data["x-amz-rules-engine-destination-arn"] === undefined) {
20
- const err1 = { instancePath, schemaPath: "#/definitions/destinationheadersJsonSchema/required", keyword: "required", params: { missingProperty: "x-amz-rules-engine-destination-arn" }, message: "must have required property '" + "x-amz-rules-engine-destination-arn" + "'" };
21
- if (vErrors === null) {
22
- vErrors = [err1];
23
- }
24
- else {
25
- vErrors.push(err1);
26
- }
27
- errors++;
28
- }
29
- for (const key0 in data) {
30
- if (!((key0 === "x-amz-rules-engine-message-type") || (key0 === "x-amz-rules-engine-destination-arn"))) {
31
- delete data[key0];
32
- }
33
- }
34
- if (data["x-amz-rules-engine-message-type"] !== undefined) {
35
- let data0 = data["x-amz-rules-engine-message-type"];
36
- const _errs4 = errors;
37
- let valid2 = false;
38
- const _errs5 = errors;
39
- if (typeof data0 !== "string") {
40
- const err2 = { instancePath: instancePath + "/x-amz-rules-engine-message-type", schemaPath: "#/definitions/destinationheadersJsonSchema/properties/x-amz-rules-engine-message-type/anyOf/0/type", keyword: "type", params: { type: "string" }, message: "must be string" };
41
- if (vErrors === null) {
42
- vErrors = [err2];
43
- }
44
- else {
45
- vErrors.push(err2);
46
- }
47
- errors++;
48
- }
49
- if ("DestinationConfirmation" !== data0) {
50
- const err3 = { instancePath: instancePath + "/x-amz-rules-engine-message-type", schemaPath: "#/definitions/destinationheadersJsonSchema/properties/x-amz-rules-engine-message-type/anyOf/0/const", keyword: "const", params: { allowedValue: "DestinationConfirmation" }, message: "must be equal to constant" };
51
- if (vErrors === null) {
52
- vErrors = [err3];
53
- }
54
- else {
55
- vErrors.push(err3);
56
- }
57
- errors++;
58
- }
59
- var _valid0 = _errs5 === errors;
60
- valid2 = valid2 || _valid0;
61
- if (!valid2) {
62
- const _errs7 = errors;
63
- if (typeof data0 !== "string") {
64
- const err4 = { instancePath: instancePath + "/x-amz-rules-engine-message-type", schemaPath: "#/definitions/destinationheadersJsonSchema/properties/x-amz-rules-engine-message-type/anyOf/1/type", keyword: "type", params: { type: "string" }, message: "must be string" };
65
- if (vErrors === null) {
66
- vErrors = [err4];
67
- }
68
- else {
69
- vErrors.push(err4);
70
- }
71
- errors++;
72
- }
73
- var _valid0 = _errs7 === errors;
74
- valid2 = valid2 || _valid0;
75
- }
76
- if (!valid2) {
77
- const err5 = { instancePath: instancePath + "/x-amz-rules-engine-message-type", schemaPath: "#/definitions/destinationheadersJsonSchema/properties/x-amz-rules-engine-message-type/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
78
- if (vErrors === null) {
79
- vErrors = [err5];
80
- }
81
- else {
82
- vErrors.push(err5);
83
- }
84
- errors++;
85
- }
86
- else {
87
- errors = _errs4;
88
- if (vErrors !== null) {
89
- if (_errs4) {
90
- vErrors.length = _errs4;
91
- }
92
- else {
93
- vErrors = null;
94
- }
95
- }
96
- }
97
- }
98
- if (data["x-amz-rules-engine-destination-arn"] !== undefined) {
99
- if (typeof data["x-amz-rules-engine-destination-arn"] !== "string") {
100
- const err6 = { instancePath: instancePath + "/x-amz-rules-engine-destination-arn", schemaPath: "#/definitions/destinationheadersJsonSchema/properties/x-amz-rules-engine-destination-arn/type", keyword: "type", params: { type: "string" }, message: "must be string" };
101
- if (vErrors === null) {
102
- vErrors = [err6];
103
- }
104
- else {
105
- vErrors.push(err6);
106
- }
107
- errors++;
108
- }
109
- }
110
- }
111
- else {
112
- const err7 = { instancePath, schemaPath: "#/definitions/destinationheadersJsonSchema/type", keyword: "type", params: { type: "object" }, message: "must be object" };
113
- if (vErrors === null) {
114
- vErrors = [err7];
115
- }
116
- else {
117
- vErrors.push(err7);
118
- }
119
- errors++;
120
- } validate10.errors = vErrors; return errors === 0; }
@@ -1,4 +0,0 @@
1
- export {validate as validateDestinationHeaders} from './validators/destinationHeaders'
2
- export * from './types/destinationHeaders'
3
- export {validate as validateConfirmationRequest} from './validators/confirmationRequest'
4
- export * from './types/confirmationRequest'
@@ -1,29 +0,0 @@
1
-
2
- /**
3
- * I am a generated file.
4
- *
5
- * If you change me, you and other developers will be sad.
6
- *
7
- * #StayGeneratedStayHappy
8
- */
9
-
10
- export type ConfirmationRequest = {
11
- arn: string;
12
- confirmationToken: string;
13
- enableUrl: string;
14
- messageType: string;
15
- };
16
-
17
-
18
-
19
- import { XubeLog } from "@xube/kit-log";
20
- import validate from "../validators/confirmationRequest";
21
-
22
- export const isConfirmationRequest = (item: unknown): item is ConfirmationRequest => {
23
- const isValid: boolean = validate(item);
24
- if(!isValid){
25
- XubeLog.getInstance().info(JSON.stringify((validate as typeof validate & {errors: object}).errors, null, 2));
26
- }
27
- return isValid;
28
- }
29
-
@@ -1,27 +0,0 @@
1
-
2
- /**
3
- * I am a generated file.
4
- *
5
- * If you change me, you and other developers will be sad.
6
- *
7
- * #StayGeneratedStayHappy
8
- */
9
-
10
- export type DestinationHeaders = {
11
- "x-amz-rules-engine-message-type": "DestinationConfirmation" | string;
12
- "x-amz-rules-engine-destination-arn": string;
13
- };
14
-
15
-
16
-
17
- import { XubeLog } from "@xube/kit-log";
18
- import validate from "../validators/destinationHeaders";
19
-
20
- export const isDestinationHeaders = (item: unknown): item is DestinationHeaders => {
21
- const isValid: boolean = validate(item);
22
- if(!isValid){
23
- XubeLog.getInstance().info(JSON.stringify((validate as typeof validate & {errors: object}).errors, null, 2));
24
- }
25
- return isValid;
26
- }
27
-
@@ -1 +0,0 @@
1
- "use strict";export const validate = validate10;export default validate10;const schema27 = {"$ref":"#/definitions/confirmationrequestJsonSchema","definitions":{"confirmationrequestJsonSchema":{"type":"object","properties":{"arn":{"type":"string"},"confirmationToken":{"type":"string"},"enableUrl":{"type":"string"},"messageType":{"type":"string"}},"required":["arn","confirmationToken","enableUrl","messageType"],"additionalProperties":true}},"$schema":"http://json-schema.org/draft-07/schema#"};const schema28 = {"type":"object","properties":{"arn":{"type":"string"},"confirmationToken":{"type":"string"},"enableUrl":{"type":"string"},"messageType":{"type":"string"}},"required":["arn","confirmationToken","enableUrl","messageType"],"additionalProperties":true};function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(data && typeof data == "object" && !Array.isArray(data)){if(data.arn === undefined){const err0 = {instancePath,schemaPath:"#/definitions/confirmationrequestJsonSchema/required",keyword:"required",params:{missingProperty: "arn"},message:"must have required property '"+"arn"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.confirmationToken === undefined){const err1 = {instancePath,schemaPath:"#/definitions/confirmationrequestJsonSchema/required",keyword:"required",params:{missingProperty: "confirmationToken"},message:"must have required property '"+"confirmationToken"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.enableUrl === undefined){const err2 = {instancePath,schemaPath:"#/definitions/confirmationrequestJsonSchema/required",keyword:"required",params:{missingProperty: "enableUrl"},message:"must have required property '"+"enableUrl"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.messageType === undefined){const err3 = {instancePath,schemaPath:"#/definitions/confirmationrequestJsonSchema/required",keyword:"required",params:{missingProperty: "messageType"},message:"must have required property '"+"messageType"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}for(const key0 in data){if(!((((key0 === "arn") || (key0 === "confirmationToken")) || (key0 === "enableUrl")) || (key0 === "messageType"))){delete data[key0];}}if(data.arn !== undefined){if(typeof data.arn !== "string"){const err4 = {instancePath:instancePath+"/arn",schemaPath:"#/definitions/confirmationrequestJsonSchema/properties/arn/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data.confirmationToken !== undefined){if(typeof data.confirmationToken !== "string"){const err5 = {instancePath:instancePath+"/confirmationToken",schemaPath:"#/definitions/confirmationrequestJsonSchema/properties/confirmationToken/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.enableUrl !== undefined){if(typeof data.enableUrl !== "string"){const err6 = {instancePath:instancePath+"/enableUrl",schemaPath:"#/definitions/confirmationrequestJsonSchema/properties/enableUrl/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.messageType !== undefined){if(typeof data.messageType !== "string"){const err7 = {instancePath:instancePath+"/messageType",schemaPath:"#/definitions/confirmationrequestJsonSchema/properties/messageType/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}}else {const err8 = {instancePath,schemaPath:"#/definitions/confirmationrequestJsonSchema/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}validate10.errors = vErrors;return errors === 0;}
@@ -1 +0,0 @@
1
- "use strict";export const validate = validate10;export default validate10;const schema27 = {"$ref":"#/definitions/destinationheadersJsonSchema","definitions":{"destinationheadersJsonSchema":{"type":"object","properties":{"x-amz-rules-engine-message-type":{"anyOf":[{"type":"string","const":"DestinationConfirmation"},{"type":"string"}]},"x-amz-rules-engine-destination-arn":{"type":"string"}},"required":["x-amz-rules-engine-message-type","x-amz-rules-engine-destination-arn"],"additionalProperties":true}},"$schema":"http://json-schema.org/draft-07/schema#"};const schema28 = {"type":"object","properties":{"x-amz-rules-engine-message-type":{"anyOf":[{"type":"string","const":"DestinationConfirmation"},{"type":"string"}]},"x-amz-rules-engine-destination-arn":{"type":"string"}},"required":["x-amz-rules-engine-message-type","x-amz-rules-engine-destination-arn"],"additionalProperties":true};function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(data && typeof data == "object" && !Array.isArray(data)){if(data["x-amz-rules-engine-message-type"] === undefined){const err0 = {instancePath,schemaPath:"#/definitions/destinationheadersJsonSchema/required",keyword:"required",params:{missingProperty: "x-amz-rules-engine-message-type"},message:"must have required property '"+"x-amz-rules-engine-message-type"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data["x-amz-rules-engine-destination-arn"] === undefined){const err1 = {instancePath,schemaPath:"#/definitions/destinationheadersJsonSchema/required",keyword:"required",params:{missingProperty: "x-amz-rules-engine-destination-arn"},message:"must have required property '"+"x-amz-rules-engine-destination-arn"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}for(const key0 in data){if(!((key0 === "x-amz-rules-engine-message-type") || (key0 === "x-amz-rules-engine-destination-arn"))){delete data[key0];}}if(data["x-amz-rules-engine-message-type"] !== undefined){let data0 = data["x-amz-rules-engine-message-type"];const _errs4 = errors;let valid2 = false;const _errs5 = errors;if(typeof data0 !== "string"){const err2 = {instancePath:instancePath+"/x-amz-rules-engine-message-type",schemaPath:"#/definitions/destinationheadersJsonSchema/properties/x-amz-rules-engine-message-type/anyOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if("DestinationConfirmation" !== data0){const err3 = {instancePath:instancePath+"/x-amz-rules-engine-message-type",schemaPath:"#/definitions/destinationheadersJsonSchema/properties/x-amz-rules-engine-message-type/anyOf/0/const",keyword:"const",params:{allowedValue: "DestinationConfirmation"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}var _valid0 = _errs5 === errors;valid2 = valid2 || _valid0;if(!valid2){const _errs7 = errors;if(typeof data0 !== "string"){const err4 = {instancePath:instancePath+"/x-amz-rules-engine-message-type",schemaPath:"#/definitions/destinationheadersJsonSchema/properties/x-amz-rules-engine-message-type/anyOf/1/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}var _valid0 = _errs7 === errors;valid2 = valid2 || _valid0;}if(!valid2){const err5 = {instancePath:instancePath+"/x-amz-rules-engine-message-type",schemaPath:"#/definitions/destinationheadersJsonSchema/properties/x-amz-rules-engine-message-type/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}else {errors = _errs4;if(vErrors !== null){if(_errs4){vErrors.length = _errs4;}else {vErrors = null;}}}}if(data["x-amz-rules-engine-destination-arn"] !== undefined){if(typeof data["x-amz-rules-engine-destination-arn"] !== "string"){const err6 = {instancePath:instancePath+"/x-amz-rules-engine-destination-arn",schemaPath:"#/definitions/destinationheadersJsonSchema/properties/x-amz-rules-engine-destination-arn/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}}else {const err7 = {instancePath,schemaPath:"#/definitions/destinationheadersJsonSchema/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}validate10.errors = vErrors;return errors === 0;}
package/src/generator.ts DELETED
@@ -1,22 +0,0 @@
1
- import {
2
- generateExportIndex,
3
- generateTypeSchemaFiles,
4
- } from "@xube/kit-generator";
5
-
6
- import { ConfirmationRequestSchema } from "./schemas/confirmation-request";
7
- import { DestinationHeadersSchema } from "./schemas/headers";
8
-
9
- const generatedFilePaths: string[] = [
10
- ...generateTypeSchemaFiles(
11
- "destinationHeaders",
12
- DestinationHeadersSchema,
13
- __dirname
14
- ),
15
- ...generateTypeSchemaFiles(
16
- "confirmationRequest",
17
- ConfirmationRequestSchema,
18
- __dirname
19
- ),
20
- ];
21
-
22
- generateExportIndex(generatedFilePaths, __dirname);