@autentikar/step 2.0.0-alpha.19 → 2.0.0-alpha.21
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/context.d.ts +1 -1
- package/dist/index-FfzUpwF2.d.ts +115 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +52 -0
- package/package.json +1 -1
- package/dist/index-mVvTh40G.d.ts +0 -67
package/dist/context.d.ts
CHANGED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as file_type_core from 'file-type/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
interface Step {
|
|
5
|
+
params<TValue = unknown>(): Promise<TValue | undefined>;
|
|
6
|
+
milestone(type: string, status: string, success: boolean): Promise<void>;
|
|
7
|
+
future(type: string, id: string, ttl: number): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare class StepRequest implements Step {
|
|
11
|
+
private step;
|
|
12
|
+
constructor(params: Step);
|
|
13
|
+
future(type: string, id: string, ttl: number): Promise<void>;
|
|
14
|
+
milestone(type: string, status: string, success: boolean): Promise<void>;
|
|
15
|
+
params<TValue = unknown>(): Promise<TValue | undefined>;
|
|
16
|
+
}
|
|
17
|
+
declare const AppEnvironmentsSchema: z.ZodObject<{
|
|
18
|
+
STAGING: z.ZodEnum<["LOCAL", "QA", "PROD"]>;
|
|
19
|
+
STEP_TYPE: z.ZodString;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
STAGING: "LOCAL" | "QA" | "PROD";
|
|
22
|
+
STEP_TYPE: string;
|
|
23
|
+
}, {
|
|
24
|
+
STAGING: "LOCAL" | "QA" | "PROD";
|
|
25
|
+
STEP_TYPE: string;
|
|
26
|
+
}>;
|
|
27
|
+
type AppEnvironments = z.infer<typeof AppEnvironmentsSchema>;
|
|
28
|
+
type Staging = AppEnvironments["STAGING"];
|
|
29
|
+
type MethodContextOrganization = {
|
|
30
|
+
id: string;
|
|
31
|
+
};
|
|
32
|
+
type MethodContextFlow = {
|
|
33
|
+
id: string;
|
|
34
|
+
params: unknown;
|
|
35
|
+
};
|
|
36
|
+
type MethodContextInstance = {
|
|
37
|
+
id: string;
|
|
38
|
+
};
|
|
39
|
+
type PersistentType = "FILESYSTEM" | "MONGODB" | "S3" | "NFS" | "S3-MRAP" | "CDN";
|
|
40
|
+
declare class StorageItem {
|
|
41
|
+
readonly path: string;
|
|
42
|
+
readonly type: PersistentType;
|
|
43
|
+
readonly buffer: Buffer;
|
|
44
|
+
readonly fileUrl: string;
|
|
45
|
+
readonly contentType: string | undefined;
|
|
46
|
+
constructor(path: string, type: PersistentType, buffer: Buffer, fileUrl: string, contentType: string | undefined);
|
|
47
|
+
getBase64(): string;
|
|
48
|
+
getContenType(): Promise<file_type_core.MimeType | "unknown">;
|
|
49
|
+
}
|
|
50
|
+
type MethodContext = {
|
|
51
|
+
staging: Staging;
|
|
52
|
+
/**
|
|
53
|
+
* no incluye schema (https://)
|
|
54
|
+
*/
|
|
55
|
+
host: string;
|
|
56
|
+
org: MethodContextOrganization;
|
|
57
|
+
flow: MethodContextFlow;
|
|
58
|
+
instance: MethodContextInstance;
|
|
59
|
+
};
|
|
60
|
+
type Method = (req: Request, output: Record<string, string>, context: MethodContext) => Promise<unknown>;
|
|
61
|
+
type AppEnv = {
|
|
62
|
+
Bindings: AppEnvironments;
|
|
63
|
+
Variables: {
|
|
64
|
+
instance: string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
declare class StepDefinition {
|
|
68
|
+
readonly id: string;
|
|
69
|
+
readonly type: string;
|
|
70
|
+
readonly prev_step: string;
|
|
71
|
+
readonly user_interaction: boolean;
|
|
72
|
+
readonly return_result: boolean;
|
|
73
|
+
readonly end_after_processing: undefined | {
|
|
74
|
+
dispatch: "NO";
|
|
75
|
+
} | {
|
|
76
|
+
dispatch: "AUTO";
|
|
77
|
+
};
|
|
78
|
+
readonly params: Record<string, string> | undefined;
|
|
79
|
+
readonly output: Record<string, string> | undefined;
|
|
80
|
+
readonly milestone: undefined | {
|
|
81
|
+
cloud_hidden?: boolean;
|
|
82
|
+
call_webhook?: boolean;
|
|
83
|
+
};
|
|
84
|
+
constructor(id: string, type: string, prev_step: string, user_interaction: boolean, return_result: boolean, end_after_processing: undefined | {
|
|
85
|
+
dispatch: "NO";
|
|
86
|
+
} | {
|
|
87
|
+
dispatch: "AUTO";
|
|
88
|
+
}, params: Record<string, string> | undefined, output: Record<string, string> | undefined, milestone: undefined | {
|
|
89
|
+
cloud_hidden?: boolean;
|
|
90
|
+
call_webhook?: boolean;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
declare class StepInstance {
|
|
94
|
+
readonly id: string;
|
|
95
|
+
readonly expires_at: number | undefined;
|
|
96
|
+
constructor(id: string, expires_at: number | undefined);
|
|
97
|
+
isExpired(): boolean | 0 | undefined;
|
|
98
|
+
}
|
|
99
|
+
declare class FlowContext {
|
|
100
|
+
readonly id: string;
|
|
101
|
+
readonly params: unknown;
|
|
102
|
+
readonly webhook: string | undefined;
|
|
103
|
+
constructor(id: string, params: unknown, webhook: string | undefined);
|
|
104
|
+
}
|
|
105
|
+
declare class StepContext {
|
|
106
|
+
readonly org: string;
|
|
107
|
+
readonly flow: FlowContext;
|
|
108
|
+
readonly step: StepDefinition;
|
|
109
|
+
readonly instance: StepInstance;
|
|
110
|
+
readonly expires_at: number | undefined;
|
|
111
|
+
constructor(org: string, flow: FlowContext, step: StepDefinition, instance: StepInstance, expires_at: number | undefined);
|
|
112
|
+
isExpired(): boolean | 0 | undefined;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export { type AppEnvironments as A, FlowContext as F, type MethodContextOrganization as M, type PersistentType as P, StorageItem as S, type Step as a, StepRequest as b, type Staging as c, type MethodContextFlow as d, type MethodContextInstance as e, type MethodContext as f, type Method as g, type AppEnv as h, StepDefinition as i, StepInstance as j, StepContext as k };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'file-type/core';
|
|
2
2
|
import 'zod';
|
|
3
|
-
export { h as AppEnv, A as AppEnvironments, g as Method, f as MethodContext, d as MethodContextFlow, e as MethodContextInstance, M as MethodContextOrganization, P as PersistentType, c as Staging, b as StepRequest, S as StorageItem } from './index-
|
|
3
|
+
export { h as AppEnv, A as AppEnvironments, F as FlowContext, g as Method, f as MethodContext, d as MethodContextFlow, e as MethodContextInstance, M as MethodContextOrganization, P as PersistentType, c as Staging, k as StepContext, i as StepDefinition, j as StepInstance, b as StepRequest, S as StorageItem } from './index-FfzUpwF2.js';
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
+
FlowContext: () => FlowContext,
|
|
34
|
+
StepContext: () => StepContext,
|
|
35
|
+
StepDefinition: () => StepDefinition,
|
|
36
|
+
StepInstance: () => StepInstance,
|
|
33
37
|
StepRequest: () => StepRequest,
|
|
34
38
|
StorageItem: () => StorageItem
|
|
35
39
|
});
|
|
@@ -78,8 +82,56 @@ var StorageItem = class {
|
|
|
78
82
|
return getContentTypeFromBuffer(this.buffer);
|
|
79
83
|
}
|
|
80
84
|
};
|
|
85
|
+
var StepDefinition = class {
|
|
86
|
+
constructor(id, type, prev_step, user_interaction, return_result, end_after_processing, params, output, milestone) {
|
|
87
|
+
this.id = id;
|
|
88
|
+
this.type = type;
|
|
89
|
+
this.prev_step = prev_step;
|
|
90
|
+
this.user_interaction = user_interaction;
|
|
91
|
+
this.return_result = return_result;
|
|
92
|
+
this.end_after_processing = end_after_processing;
|
|
93
|
+
this.params = params;
|
|
94
|
+
this.output = output;
|
|
95
|
+
this.milestone = milestone;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
var StepInstance = class {
|
|
99
|
+
constructor(id, expires_at) {
|
|
100
|
+
this.id = id;
|
|
101
|
+
this.expires_at = expires_at;
|
|
102
|
+
}
|
|
103
|
+
// public isInvalid() {
|
|
104
|
+
// return this.expires_at && this.expires_at < Date.now();
|
|
105
|
+
// }
|
|
106
|
+
isExpired() {
|
|
107
|
+
return this.expires_at && this.expires_at < Date.now();
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
var FlowContext = class {
|
|
111
|
+
constructor(id, params, webhook) {
|
|
112
|
+
this.id = id;
|
|
113
|
+
this.params = params;
|
|
114
|
+
this.webhook = webhook;
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
var StepContext = class {
|
|
118
|
+
constructor(org, flow, step, instance, expires_at) {
|
|
119
|
+
this.org = org;
|
|
120
|
+
this.flow = flow;
|
|
121
|
+
this.step = step;
|
|
122
|
+
this.instance = instance;
|
|
123
|
+
this.expires_at = expires_at;
|
|
124
|
+
}
|
|
125
|
+
isExpired() {
|
|
126
|
+
return this.expires_at && this.expires_at < Date.now();
|
|
127
|
+
}
|
|
128
|
+
};
|
|
81
129
|
// Annotate the CommonJS export names for ESM import in node:
|
|
82
130
|
0 && (module.exports = {
|
|
131
|
+
FlowContext,
|
|
132
|
+
StepContext,
|
|
133
|
+
StepDefinition,
|
|
134
|
+
StepInstance,
|
|
83
135
|
StepRequest,
|
|
84
136
|
StorageItem
|
|
85
137
|
});
|
package/package.json
CHANGED
package/dist/index-mVvTh40G.d.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import * as file_type_core from 'file-type/core';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
|
|
4
|
-
interface Step {
|
|
5
|
-
params<TValue = unknown>(): Promise<TValue | undefined>;
|
|
6
|
-
milestone(type: string, status: string, success: boolean): Promise<void>;
|
|
7
|
-
future(type: string, id: string, ttl: number): Promise<void>;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
declare class StepRequest implements Step {
|
|
11
|
-
private step;
|
|
12
|
-
constructor(params: Step);
|
|
13
|
-
future(type: string, id: string, ttl: number): Promise<void>;
|
|
14
|
-
milestone(type: string, status: string, success: boolean): Promise<void>;
|
|
15
|
-
params<TValue = unknown>(): Promise<TValue | undefined>;
|
|
16
|
-
}
|
|
17
|
-
declare const AppEnvironmentsSchema: z.ZodObject<{
|
|
18
|
-
STAGING: z.ZodEnum<["LOCAL", "QA", "PROD"]>;
|
|
19
|
-
STEP_TYPE: z.ZodString;
|
|
20
|
-
}, "strip", z.ZodTypeAny, {
|
|
21
|
-
STAGING: "LOCAL" | "QA" | "PROD";
|
|
22
|
-
STEP_TYPE: string;
|
|
23
|
-
}, {
|
|
24
|
-
STAGING: "LOCAL" | "QA" | "PROD";
|
|
25
|
-
STEP_TYPE: string;
|
|
26
|
-
}>;
|
|
27
|
-
type AppEnvironments = z.infer<typeof AppEnvironmentsSchema>;
|
|
28
|
-
type Staging = AppEnvironments["STAGING"];
|
|
29
|
-
type MethodContextOrganization = {
|
|
30
|
-
id: string;
|
|
31
|
-
};
|
|
32
|
-
type MethodContextFlow = {
|
|
33
|
-
id: string;
|
|
34
|
-
};
|
|
35
|
-
type MethodContextInstance = {
|
|
36
|
-
id: string;
|
|
37
|
-
};
|
|
38
|
-
type PersistentType = "FILESYSTEM" | "MONGODB" | "S3" | "NFS" | "S3-MRAP" | "CDN";
|
|
39
|
-
declare class StorageItem {
|
|
40
|
-
readonly path: string;
|
|
41
|
-
readonly type: PersistentType;
|
|
42
|
-
readonly buffer: Buffer;
|
|
43
|
-
readonly fileUrl: string;
|
|
44
|
-
readonly contentType: string | undefined;
|
|
45
|
-
constructor(path: string, type: PersistentType, buffer: Buffer, fileUrl: string, contentType: string | undefined);
|
|
46
|
-
getBase64(): string;
|
|
47
|
-
getContenType(): Promise<file_type_core.MimeType | "unknown">;
|
|
48
|
-
}
|
|
49
|
-
type MethodContext = {
|
|
50
|
-
staging: Staging;
|
|
51
|
-
/**
|
|
52
|
-
* no incluye schema (https://)
|
|
53
|
-
*/
|
|
54
|
-
host: string;
|
|
55
|
-
org: MethodContextOrganization;
|
|
56
|
-
flow: MethodContextFlow;
|
|
57
|
-
instance: MethodContextInstance;
|
|
58
|
-
};
|
|
59
|
-
type Method = (req: Request, output: Record<string, string>, context: MethodContext) => Promise<unknown>;
|
|
60
|
-
type AppEnv = {
|
|
61
|
-
Bindings: AppEnvironments;
|
|
62
|
-
Variables: {
|
|
63
|
-
instance: string;
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export { type AppEnvironments as A, type MethodContextOrganization as M, type PersistentType as P, StorageItem as S, type Step as a, StepRequest as b, type Staging as c, type MethodContextFlow as d, type MethodContextInstance as e, type MethodContext as f, type Method as g, type AppEnv as h };
|