@daymaker/sdk 0.0.0-stage → 0.4.0
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/LICENSE +29 -0
- package/README.md +33 -2
- package/dist/client.d.ts +75 -0
- package/dist/client.js +322 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +62 -0
- package/dist/errors.js +104 -0
- package/dist/errors.js.map +1 -0
- package/dist/generated/operations.d.ts +1672 -0
- package/dist/generated/operations.js +2027 -0
- package/dist/generated/operations.js.map +1 -0
- package/dist/generated/schema.d.ts +3853 -0
- package/dist/generated/schema.js +2 -0
- package/dist/generated/schema.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/operation-spec.d.ts +44 -0
- package/dist/operation-spec.js +2 -0
- package/dist/operation-spec.js.map +1 -0
- package/dist/types.d.ts +78 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/package.json +43 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/generated/schema.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { DaymakerClient, DEFAULT_API_URL, resolveUrls, type DaymakerClientOptions, type ResolvedUrls } from "./client.js";
|
|
2
|
+
export { CHECK_BEFORE_RETRY, DaymakerError, isDaymakerError, parseRetryAfter, type DaymakerErrorKind, type DaymakerFieldProblem, } from "./errors.js";
|
|
3
|
+
export { OPERATIONS, SPEC_VERSION, type OperationId } from "./generated/operations.js";
|
|
4
|
+
export type { OperationSpec, HttpMethod, KeyScope } from "./operation-spec.js";
|
|
5
|
+
export type { DaymakerOperations, DaymakerResponse, JsonObject, OperationArgs, OperationInput, OperationOutput, PagedOperationId, RequestOptions, } from "./types.js";
|
|
6
|
+
export { SDK_VERSION } from "./version.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { DaymakerClient, DEFAULT_API_URL, resolveUrls } from "./client.js";
|
|
2
|
+
export { CHECK_BEFORE_RETRY, DaymakerError, isDaymakerError, parseRetryAfter, } from "./errors.js";
|
|
3
|
+
export { OPERATIONS, SPEC_VERSION } from "./generated/operations.js";
|
|
4
|
+
export { SDK_VERSION } from "./version.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAiD,MAAM,aAAa,CAAC;AAC1H,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,eAAe,GAGhB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,YAAY,EAAoB,MAAM,2BAA2B,CAAC;AAYvF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
2
|
+
/**
|
|
3
|
+
* What a key may do, chosen when the key is made. `read` sees the workspace
|
|
4
|
+
* and prices, `work` changes it (some of it uses credits), `send` reaches
|
|
5
|
+
* people and money in the key owner's name.
|
|
6
|
+
*/
|
|
7
|
+
export type KeyScope = "read" | "work" | "send";
|
|
8
|
+
/** One Daymaker API operation, as generated from the published contract. */
|
|
9
|
+
export interface OperationSpec {
|
|
10
|
+
readonly operationId: string;
|
|
11
|
+
readonly method: HttpMethod;
|
|
12
|
+
/** Path below the API base URL, e.g. `/leads/{lead_id}`. */
|
|
13
|
+
readonly path: string;
|
|
14
|
+
readonly summary: string;
|
|
15
|
+
readonly description: string;
|
|
16
|
+
/** The contract's group: Workspace, Leads, Gifts, Campaigns, Sending, Orders, Pipeline or Signals. */
|
|
17
|
+
readonly tag: string;
|
|
18
|
+
/** The key scope the operation needs. A key without it gets 403 `insufficient_scope`. */
|
|
19
|
+
readonly scope: KeyScope;
|
|
20
|
+
/** The tool of the hosted Daymaker MCP server that does the same thing, when there is one. */
|
|
21
|
+
readonly mcpTool: string | null;
|
|
22
|
+
/** True when the operation can use credits: it takes `max_credits`, the most the person agreed to spend. */
|
|
23
|
+
readonly credits: boolean;
|
|
24
|
+
/** Whether the API takes an `Idempotency-Key` header, and whether it insists. */
|
|
25
|
+
readonly idempotency: "required" | "optional" | "none";
|
|
26
|
+
/** Safe to send again after a timeout or a 5xx: a read, a price check, or a write that carries an Idempotency-Key. */
|
|
27
|
+
readonly retrySafe: boolean;
|
|
28
|
+
readonly pathParams: readonly string[];
|
|
29
|
+
readonly queryParams: readonly {
|
|
30
|
+
readonly name: string;
|
|
31
|
+
readonly required: boolean;
|
|
32
|
+
}[];
|
|
33
|
+
readonly bodyFields: readonly string[];
|
|
34
|
+
readonly hasBody: boolean;
|
|
35
|
+
/** Flattened JSON Schema of the SDK and MCP input: path, query and body fields side by side, plus `idempotency_key` where the API takes one. */
|
|
36
|
+
readonly inputSchema: {
|
|
37
|
+
readonly type: "object";
|
|
38
|
+
readonly properties: {
|
|
39
|
+
readonly [name: string]: unknown;
|
|
40
|
+
};
|
|
41
|
+
readonly required?: readonly string[];
|
|
42
|
+
readonly additionalProperties: false;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-spec.js","sourceRoot":"","sources":["../src/operation-spec.ts"],"names":[],"mappings":""}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { operations } from "./generated/schema.js";
|
|
2
|
+
import type { OPERATIONS, OperationId } from "./generated/operations.js";
|
|
3
|
+
export type { OperationId };
|
|
4
|
+
export type JsonObject = {
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
};
|
|
7
|
+
type Simplify<T> = {
|
|
8
|
+
[K in keyof T]: T[K];
|
|
9
|
+
} & {};
|
|
10
|
+
type ObjectOrEmpty<T> = [T] extends [never] ? {} : [T] extends [undefined] ? {} : T extends object ? T : {};
|
|
11
|
+
type Op<K extends OperationId> = operations[K];
|
|
12
|
+
type Params<K extends OperationId> = Op<K> extends {
|
|
13
|
+
parameters: infer P;
|
|
14
|
+
} ? P : never;
|
|
15
|
+
type PathOf<K extends OperationId> = ObjectOrEmpty<NonNullable<Params<K> extends {
|
|
16
|
+
path?: infer X;
|
|
17
|
+
} ? X : never>>;
|
|
18
|
+
type QueryOf<K extends OperationId> = ObjectOrEmpty<NonNullable<Params<K> extends {
|
|
19
|
+
query?: infer X;
|
|
20
|
+
} ? X : never>>;
|
|
21
|
+
type BodyOf<K extends OperationId> = ObjectOrEmpty<NonNullable<Op<K> extends {
|
|
22
|
+
requestBody?: infer B;
|
|
23
|
+
} ? B : never> extends {
|
|
24
|
+
content: {
|
|
25
|
+
"application/json": infer J;
|
|
26
|
+
};
|
|
27
|
+
} ? J : never>;
|
|
28
|
+
type IdempotencyOf<K extends OperationId> = (typeof OPERATIONS)[K]["idempotency"] extends "none" ? {} : {
|
|
29
|
+
/** Sent as the `Idempotency-Key` header. Generated for you when left out; send the same one again to retry without acting twice. */
|
|
30
|
+
idempotency_key?: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* The flattened input of one operation: path params, query params and body
|
|
34
|
+
* fields side by side, plus `idempotency_key` where the API takes one.
|
|
35
|
+
*/
|
|
36
|
+
export type OperationInput<K extends OperationId> = Simplify<PathOf<K> & QueryOf<K> & BodyOf<K> & IdempotencyOf<K>>;
|
|
37
|
+
type ResponsesOf<K extends OperationId> = Op<K> extends {
|
|
38
|
+
responses: infer R;
|
|
39
|
+
} ? R : never;
|
|
40
|
+
type JsonOf<T> = T extends {
|
|
41
|
+
content: {
|
|
42
|
+
"application/json": infer J;
|
|
43
|
+
};
|
|
44
|
+
} ? J : never;
|
|
45
|
+
type SuccessOf<R> = {
|
|
46
|
+
[S in keyof R]: S extends 200 | 201 | 202 ? JsonOf<R[S]> : never;
|
|
47
|
+
}[keyof R];
|
|
48
|
+
/** The body of a 200, 201 or 202 answer, as the contract describes it. A field with nothing in it is left out, so read a missing field as empty. */
|
|
49
|
+
export type OperationOutput<K extends OperationId> = [SuccessOf<ResponsesOf<K>>] extends [never] ? JsonObject : SuccessOf<ResponsesOf<K>>;
|
|
50
|
+
/** The lists that take `offset` and answer `next_offset`. */
|
|
51
|
+
export type PagedOperationId = {
|
|
52
|
+
[K in OperationId]: "offset" extends keyof QueryOf<K> ? K : never;
|
|
53
|
+
}[OperationId];
|
|
54
|
+
export interface RequestOptions {
|
|
55
|
+
/** Overrides `idempotency_key` in the input. */
|
|
56
|
+
idempotencyKey?: string;
|
|
57
|
+
signal?: AbortSignal;
|
|
58
|
+
timeoutMs?: number;
|
|
59
|
+
maxRetries?: number;
|
|
60
|
+
headers?: Record<string, string>;
|
|
61
|
+
}
|
|
62
|
+
export interface DaymakerResponse<T> {
|
|
63
|
+
data: T;
|
|
64
|
+
status: number;
|
|
65
|
+
/** `X-Request-Id`: quote it when asking Daymaker about this request. */
|
|
66
|
+
requestId: string | null;
|
|
67
|
+
/** The key that was sent, so you can keep it and retry later without acting twice. */
|
|
68
|
+
idempotencyKey: string | null;
|
|
69
|
+
/** True when the API gave back the first answer for this key instead of acting again. */
|
|
70
|
+
idempotentReplay: boolean;
|
|
71
|
+
attempts: number;
|
|
72
|
+
headers: Headers;
|
|
73
|
+
}
|
|
74
|
+
export type OperationArgs<K extends OperationId> = {} extends OperationInput<K> ? [input?: OperationInput<K>, options?: RequestOptions] : [input: OperationInput<K>, options?: RequestOptions];
|
|
75
|
+
/** One method per Daymaker API operation, named by its `operationId`. */
|
|
76
|
+
export type DaymakerOperations = {
|
|
77
|
+
[K in OperationId]: (...args: OperationArgs<K>) => Promise<OperationOutput<K>>;
|
|
78
|
+
};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SDK_VERSION = "0.4.0";
|
package/dist/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@daymaker/sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Typed client for the Daymaker API (https://daymaker.com/api/v2).",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/daymaker-hq/daymaker-for-agents.git",
|
|
10
|
+
"directory": "packages/sdk"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://daymaker.com",
|
|
13
|
+
"bugs": "https://github.com/daymaker-hq/daymaker-for-agents/issues",
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"main": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"import": "./dist/index.js",
|
|
23
|
+
"default": "./dist/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"LICENSE",
|
|
29
|
+
"README.md"
|
|
30
|
+
],
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=22"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsc -p tsconfig.build.json"
|
|
36
|
+
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"daymaker",
|
|
39
|
+
"gifts",
|
|
40
|
+
"gifting",
|
|
41
|
+
"leads",
|
|
42
|
+
"sdk",
|
|
43
|
+
"api"
|
|
44
|
+
]
|
|
45
|
+
}
|