@superdurable/connector-fit2cloud 0.0.0-stage → 0.1.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 +21 -0
- package/README.md +4 -2
- package/dex-connector.json +65 -0
- package/dist/chunk-ZCCJ5ZFA.js +126 -0
- package/dist/connection-DfpMBv8i.d.ts +105 -0
- package/dist/index.d.ts +90 -0
- package/dist/index.js +205 -0
- package/dist/mock.d.ts +35 -0
- package/dist/mock.js +78 -0
- package/package.json +59 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Super Durable
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Halo TypeScript connector
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Read one page of Halo article names, titles, slugs, publication state, and visibility.
|
|
4
|
+
|
|
5
|
+
Install `@superdurable/connector-fit2cloud` and use `newProjectConnection` with the static connection name in the runnable [`examples/basic`](examples/basic) Flow. Configure the connection and provider credentials in Dex Web Connections. The operation `listPosts` resolves credentials for each call. Local conformance tests replay the Go provider scenarios; live provider authorization has not been verified.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"connectorId": "fit2cloud",
|
|
3
|
+
"releaseTag": "connectors/fit2cloud/go/v0.1.0",
|
|
4
|
+
"package": {
|
|
5
|
+
"ecosystem": "npm",
|
|
6
|
+
"name": "@superdurable/connector-fit2cloud",
|
|
7
|
+
"version": "0.1.0"
|
|
8
|
+
},
|
|
9
|
+
"factories": [
|
|
10
|
+
{
|
|
11
|
+
"name": "newListPostsStep",
|
|
12
|
+
"kind": "query",
|
|
13
|
+
"operationId": "listPosts",
|
|
14
|
+
"inputType": "ListPostsInput",
|
|
15
|
+
"description": "List one page of Halo article metadata.",
|
|
16
|
+
"fields": {
|
|
17
|
+
"stepType": "stepType",
|
|
18
|
+
"annotations": "annotations",
|
|
19
|
+
"connectionName": "connectionName",
|
|
20
|
+
"resultAttribute": "resultAttribute"
|
|
21
|
+
},
|
|
22
|
+
"branches": [
|
|
23
|
+
{
|
|
24
|
+
"id": "listed",
|
|
25
|
+
"field": "listed",
|
|
26
|
+
"optional": false
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"id": "providerRejected",
|
|
30
|
+
"field": "providerRejected",
|
|
31
|
+
"optional": true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "invalidResponse",
|
|
35
|
+
"field": "invalidResponse",
|
|
36
|
+
"optional": true
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": "defect",
|
|
40
|
+
"field": "defect",
|
|
41
|
+
"optional": true
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"inputSchema": {
|
|
45
|
+
"additionalProperties": false,
|
|
46
|
+
"description": "ListPostsInput selects a one-based article page; zero values use page 1 and 20 articles.",
|
|
47
|
+
"properties": {
|
|
48
|
+
"page": {
|
|
49
|
+
"description": "Page is the one-based article page number.",
|
|
50
|
+
"type": "integer"
|
|
51
|
+
},
|
|
52
|
+
"pageSize": {
|
|
53
|
+
"description": "PageSize is the number of articles requested, from 1 to 100.",
|
|
54
|
+
"type": "integer"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"required": [
|
|
58
|
+
"page",
|
|
59
|
+
"pageSize"
|
|
60
|
+
],
|
|
61
|
+
"type": "object"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// src/generated/models.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { SecretString } from "@superdurable/connectors-sdk";
|
|
4
|
+
var ConfigSchema = z.object({
|
|
5
|
+
"baseUrl": z.string(),
|
|
6
|
+
"timeoutMs": z.number().int().optional(),
|
|
7
|
+
"maxResponseBytes": z.number().int().optional()
|
|
8
|
+
});
|
|
9
|
+
var CredentialMaterialError = class extends TypeError {
|
|
10
|
+
constructor(message) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = "CredentialMaterialError";
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var sdkCredentialDecodingFailureMessages = /* @__PURE__ */ new Set([
|
|
16
|
+
"project credential decoding failed",
|
|
17
|
+
"shared project credential decoding failed",
|
|
18
|
+
"project credential decoding failed: this connector version does not support shared credentials"
|
|
19
|
+
]);
|
|
20
|
+
function isCredentialMaterialError(error) {
|
|
21
|
+
return error instanceof CredentialMaterialError || error instanceof TypeError && sdkCredentialDecodingFailureMessages.has(error.message);
|
|
22
|
+
}
|
|
23
|
+
function decodeCredentials(value) {
|
|
24
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new CredentialMaterialError("credential fields are invalid");
|
|
25
|
+
const fields = value;
|
|
26
|
+
const allowed = /* @__PURE__ */ new Set(["api_key"]);
|
|
27
|
+
if (Object.keys(fields).some((key) => !allowed.has(key))) throw new CredentialMaterialError("stored credential does not match the connector credential fields");
|
|
28
|
+
if (fields["api_key"] != null && !(typeof fields["api_key"] === "string")) throw new CredentialMaterialError("credential api_key has an invalid type");
|
|
29
|
+
const credentials = {};
|
|
30
|
+
if (!fields["api_key"]) throw new CredentialMaterialError("credential api_key is required");
|
|
31
|
+
credentials.apiKey = new SecretString(fields["api_key"] ?? "");
|
|
32
|
+
return credentials;
|
|
33
|
+
}
|
|
34
|
+
var ListPostsInputSchema = z.strictObject({
|
|
35
|
+
"page": z.number().int(),
|
|
36
|
+
"pageSize": z.number().int()
|
|
37
|
+
});
|
|
38
|
+
var PostSummarySchema = z.strictObject({
|
|
39
|
+
"name": z.string(),
|
|
40
|
+
"title": z.string(),
|
|
41
|
+
"slug": z.string(),
|
|
42
|
+
"published": z.boolean(),
|
|
43
|
+
"visibility": z.string()
|
|
44
|
+
});
|
|
45
|
+
var ListPostsOutputSchema = z.strictObject({
|
|
46
|
+
"posts": z.array(PostSummarySchema).nullable(),
|
|
47
|
+
"nextPage": z.number().int()
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// src/generated/definitions.ts
|
|
51
|
+
var ConnectorID = "fit2cloud";
|
|
52
|
+
var ProviderID = "fit2cloud";
|
|
53
|
+
var ListPostsBranch = {
|
|
54
|
+
Listed: "listed",
|
|
55
|
+
ProviderRejected: "providerRejected",
|
|
56
|
+
InvalidResponse: "invalidResponse",
|
|
57
|
+
Defect: "defect"
|
|
58
|
+
};
|
|
59
|
+
var ListPostsBranchListed = ListPostsBranch.Listed;
|
|
60
|
+
var ListPostsBranchProviderRejected = ListPostsBranch.ProviderRejected;
|
|
61
|
+
var ListPostsBranchInvalidResponse = ListPostsBranch.InvalidResponse;
|
|
62
|
+
var ListPostsBranchDefect = ListPostsBranch.Defect;
|
|
63
|
+
var ListPostsDefinition = {
|
|
64
|
+
operation: { connectorId: ConnectorID, operationId: "listPosts" },
|
|
65
|
+
branches: [
|
|
66
|
+
{ id: "listed", description: "Halo returned an article page." },
|
|
67
|
+
{ id: "providerRejected", description: "Halo rejected the token or access.", optional: true },
|
|
68
|
+
{ id: "invalidResponse", description: "Halo returned malformed or oversized data.", optional: true },
|
|
69
|
+
{ id: "defect", description: "Local credentials or pagination are invalid.", optional: true }
|
|
70
|
+
],
|
|
71
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
72
|
+
};
|
|
73
|
+
var ListPostsMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
74
|
+
|
|
75
|
+
// src/generated/connection.ts
|
|
76
|
+
import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
|
|
77
|
+
var Connection = class {
|
|
78
|
+
/** Stable provider and connection name. */
|
|
79
|
+
reference;
|
|
80
|
+
/** Bound provider operations. */
|
|
81
|
+
operations;
|
|
82
|
+
/** Validate a reference and bind operations. */
|
|
83
|
+
constructor(reference, operations) {
|
|
84
|
+
this.reference = ConnectionRefSchema.parse(reference);
|
|
85
|
+
if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
|
|
86
|
+
if (!operations) throw new TypeError("connector operations are required");
|
|
87
|
+
this.operations = operations;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
function newConnection(client, reference) {
|
|
91
|
+
if (!client) throw new TypeError("connector client is required");
|
|
92
|
+
return new Connection(reference, client);
|
|
93
|
+
}
|
|
94
|
+
function newConnectionWithOperations(operations, reference) {
|
|
95
|
+
return new Connection(reference, operations);
|
|
96
|
+
}
|
|
97
|
+
function newProjectConnection(project, connectionName, createClient) {
|
|
98
|
+
if (!project) throw new TypeError("loaded project is required");
|
|
99
|
+
const reference = ConnectionRefSchema.parse({ provider: ProviderID, name: connectionName });
|
|
100
|
+
const selected = project.configuration.connections.find((entry) => entry.connectorId === ConnectorID && entry.connectionName === connectionName);
|
|
101
|
+
if (!selected || selected.provider !== ProviderID) throw new TypeError("project connection is not configured");
|
|
102
|
+
return newConnection(createClient(project, connectionName), reference);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export {
|
|
106
|
+
ConfigSchema,
|
|
107
|
+
CredentialMaterialError,
|
|
108
|
+
isCredentialMaterialError,
|
|
109
|
+
decodeCredentials,
|
|
110
|
+
ListPostsInputSchema,
|
|
111
|
+
PostSummarySchema,
|
|
112
|
+
ListPostsOutputSchema,
|
|
113
|
+
ConnectorID,
|
|
114
|
+
ProviderID,
|
|
115
|
+
ListPostsBranch,
|
|
116
|
+
ListPostsBranchListed,
|
|
117
|
+
ListPostsBranchProviderRejected,
|
|
118
|
+
ListPostsBranchInvalidResponse,
|
|
119
|
+
ListPostsBranchDefect,
|
|
120
|
+
ListPostsDefinition,
|
|
121
|
+
ListPostsMetadata,
|
|
122
|
+
Connection,
|
|
123
|
+
newConnection,
|
|
124
|
+
newConnectionWithOperations,
|
|
125
|
+
newProjectConnection
|
|
126
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { CredentialProvider, SecretString, Query, ConnectionRef } from '@superdurable/connectors-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
/** Connector configuration; omitted fields use manifest defaults. */
|
|
5
|
+
interface Config {
|
|
6
|
+
/** HTTPS origin of your Halo CMS site, copied from its browser address bar after your administrator enables HTTPS. Include scheme and host only, without /apis; blank prevents connection. See https://docs.halo.run/developer-guide/restful-api/introduction. */
|
|
7
|
+
baseUrl: string;
|
|
8
|
+
/** Maximum time for one article-list request as a positive Go duration such as 5s or 1m. Leave blank for the displayed default; raise only for a slow Halo site. Runtime value in milliseconds. */
|
|
9
|
+
timeoutMs?: number;
|
|
10
|
+
/** Maximum article-list response size in bytes as a positive integer. Leave blank for the displayed default; raise only for a legitimate larger page. */
|
|
11
|
+
maxResponseBytes?: number;
|
|
12
|
+
}
|
|
13
|
+
/** Runtime schema for manifest configuration. */
|
|
14
|
+
declare const ConfigSchema: z.ZodObject<{
|
|
15
|
+
baseUrl: z.ZodString;
|
|
16
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
maxResponseBytes: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
/** Private connector credentials resolved by the host. */
|
|
20
|
+
interface Credentials {
|
|
21
|
+
/** Personal access token from your Halo HTTPS site > personal center > Personal Access Tokens. Create a token with read permission for posts, copy its pat_ prefixed value into this secret field, and set an expiry. Dex stores it only as a credential; blank prevents requests. See https://docs.halo.run/guide/use/user-center. */
|
|
22
|
+
apiKey: SecretString;
|
|
23
|
+
}
|
|
24
|
+
/** Stored credential material that fails the connector credential checks, so no retry can succeed. */
|
|
25
|
+
declare class CredentialMaterialError extends TypeError {
|
|
26
|
+
constructor(message: string);
|
|
27
|
+
}
|
|
28
|
+
/** Report malformed stored credential material, also behind the SDK provider's decoding TypeError. */
|
|
29
|
+
declare function isCredentialMaterialError(error: unknown): boolean;
|
|
30
|
+
/** Decode private credential fields for the connector. */
|
|
31
|
+
declare function decodeCredentials(value: unknown): Credentials;
|
|
32
|
+
/** Host-owned source of private connector credentials. */
|
|
33
|
+
type CredentialSource = CredentialProvider<Credentials>;
|
|
34
|
+
/** ListPostsInput selects a one-based article page; zero values use page 1 and 20 articles. */
|
|
35
|
+
interface ListPostsInput {
|
|
36
|
+
/** Page is the one-based article page number. */
|
|
37
|
+
"page": number;
|
|
38
|
+
/** PageSize is the number of articles requested, from 1 to 100. */
|
|
39
|
+
"pageSize": number;
|
|
40
|
+
}
|
|
41
|
+
/** PostSummary contains article identity and publication metadata without content or author details. */
|
|
42
|
+
interface PostSummary {
|
|
43
|
+
/** Name is the stable Halo metadata name. */
|
|
44
|
+
"name": string;
|
|
45
|
+
/** Title is the article title. */
|
|
46
|
+
"title": string;
|
|
47
|
+
/** Slug is the article URL slug. */
|
|
48
|
+
"slug": string;
|
|
49
|
+
/** Published reports whether the article is published. */
|
|
50
|
+
"published": boolean;
|
|
51
|
+
/** Visibility is PUBLIC, INTERNAL, or PRIVATE. */
|
|
52
|
+
"visibility": string;
|
|
53
|
+
}
|
|
54
|
+
/** ListPostsOutput contains one article page and the next page number, or zero at the end. */
|
|
55
|
+
interface ListPostsOutput {
|
|
56
|
+
/** Posts are the returned articles in provider order. */
|
|
57
|
+
"posts": Array<PostSummary> | null;
|
|
58
|
+
/** NextPage is the next one-based page number, or zero if the page is terminal. */
|
|
59
|
+
"nextPage": number;
|
|
60
|
+
}
|
|
61
|
+
/** Runtime validator for ListPostsInput. */
|
|
62
|
+
declare const ListPostsInputSchema: z.ZodObject<{
|
|
63
|
+
page: z.ZodNumber;
|
|
64
|
+
pageSize: z.ZodNumber;
|
|
65
|
+
}, z.core.$strict>;
|
|
66
|
+
/** Runtime validator for PostSummary. */
|
|
67
|
+
declare const PostSummarySchema: z.ZodObject<{
|
|
68
|
+
name: z.ZodString;
|
|
69
|
+
title: z.ZodString;
|
|
70
|
+
slug: z.ZodString;
|
|
71
|
+
published: z.ZodBoolean;
|
|
72
|
+
visibility: z.ZodString;
|
|
73
|
+
}, z.core.$strict>;
|
|
74
|
+
/** Runtime validator for ListPostsOutput. */
|
|
75
|
+
declare const ListPostsOutputSchema: z.ZodObject<{
|
|
76
|
+
posts: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
77
|
+
name: z.ZodString;
|
|
78
|
+
title: z.ZodString;
|
|
79
|
+
slug: z.ZodString;
|
|
80
|
+
published: z.ZodBoolean;
|
|
81
|
+
visibility: z.ZodString;
|
|
82
|
+
}, z.core.$strict>>>;
|
|
83
|
+
nextPage: z.ZodNumber;
|
|
84
|
+
}, z.core.$strict>;
|
|
85
|
+
|
|
86
|
+
/** Typed operations supplied by a client or mock. */
|
|
87
|
+
interface Operations {
|
|
88
|
+
/** Invoke listPosts through this connection. */
|
|
89
|
+
listPosts(): Query<ListPostsInput, ListPostsOutput>;
|
|
90
|
+
}
|
|
91
|
+
/** Named connector connection kept outside Flow state. */
|
|
92
|
+
declare class Connection<BoundOperations = Operations> {
|
|
93
|
+
/** Stable provider and connection name. */
|
|
94
|
+
readonly reference: ConnectionRef;
|
|
95
|
+
/** Bound provider operations. */
|
|
96
|
+
readonly operations: BoundOperations;
|
|
97
|
+
/** Validate a reference and bind operations. */
|
|
98
|
+
constructor(reference: ConnectionRef, operations: BoundOperations);
|
|
99
|
+
}
|
|
100
|
+
/** Bind a client to a named connection. */
|
|
101
|
+
declare function newConnection(client: Operations, reference: ConnectionRef): Connection;
|
|
102
|
+
/** Bind scripted operations to a named connection. */
|
|
103
|
+
declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
|
|
104
|
+
|
|
105
|
+
export { Connection as C, type ListPostsInput as L, type Operations as O, type PostSummary as P, type ListPostsOutput as a, type Config as b, type Credentials as c, ConfigSchema as d, CredentialMaterialError as e, type CredentialSource as f, ListPostsInputSchema as g, ListPostsOutputSchema as h, PostSummarySchema as i, decodeCredentials as j, isCredentialMaterialError as k, newConnectionWithOperations as l, newConnection as n };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { L as ListPostsInput, a as ListPostsOutput, C as Connection, O as Operations, b as Config, c as Credentials } from './connection-DfpMBv8i.js';
|
|
2
|
+
export { d as ConfigSchema, e as CredentialMaterialError, f as CredentialSource, g as ListPostsInputSchema, h as ListPostsOutputSchema, P as PostSummary, i as PostSummarySchema, j as decodeCredentials, k as isCredentialMaterialError, n as newConnection, l as newConnectionWithOperations } from './connection-DfpMBv8i.js';
|
|
3
|
+
import { QueryDefinition, QueryStepConfig, Query, QueryResult, QueryStep, CredentialProvider, Call, QueryAttempt } from '@superdurable/connectors-sdk';
|
|
4
|
+
import { StepTarget } from '@superdurable/dex';
|
|
5
|
+
import { LoadedProject } from '@superdurable/connectors-sdk/projectconfig';
|
|
6
|
+
import { ProviderRequest, ProviderResponse } from '@superdurable/connectors-sdk/providerhttp';
|
|
7
|
+
import 'zod';
|
|
8
|
+
|
|
9
|
+
/** Stable connector identity. */
|
|
10
|
+
declare const ConnectorID = "fit2cloud";
|
|
11
|
+
/** Provider identity for named connections. */
|
|
12
|
+
declare const ProviderID = "fit2cloud";
|
|
13
|
+
/** Branch IDs for listPosts. */
|
|
14
|
+
declare const ListPostsBranch: {
|
|
15
|
+
readonly Listed: "listed";
|
|
16
|
+
readonly ProviderRejected: "providerRejected";
|
|
17
|
+
readonly InvalidResponse: "invalidResponse";
|
|
18
|
+
readonly Defect: "defect";
|
|
19
|
+
};
|
|
20
|
+
/** Halo returned an article page. */
|
|
21
|
+
declare const ListPostsBranchListed: "listed";
|
|
22
|
+
/** Halo rejected the token or access. */
|
|
23
|
+
declare const ListPostsBranchProviderRejected: "providerRejected";
|
|
24
|
+
/** Halo returned malformed or oversized data. */
|
|
25
|
+
declare const ListPostsBranchInvalidResponse: "invalidResponse";
|
|
26
|
+
/** Local credentials or pagination are invalid. */
|
|
27
|
+
declare const ListPostsBranchDefect: "defect";
|
|
28
|
+
/** Manifest definition for listPosts. */
|
|
29
|
+
declare const ListPostsDefinition: QueryDefinition;
|
|
30
|
+
/** Manifest metadata for listPosts. */
|
|
31
|
+
declare const ListPostsMetadata: {
|
|
32
|
+
readonly kind: "query";
|
|
33
|
+
readonly idempotency: "none";
|
|
34
|
+
readonly authorization: "required";
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** Configuration for the listPosts connector Step. */
|
|
38
|
+
interface ListPostsStepConfig<StepInput, OperationInput = ListPostsInput, OperationOutput = ListPostsOutput> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
39
|
+
/** Named connection supplying this operation. */
|
|
40
|
+
connection: Connection<{
|
|
41
|
+
listPosts(): Query<OperationInput, OperationOutput>;
|
|
42
|
+
}>;
|
|
43
|
+
/** Name matching the bound connection. */
|
|
44
|
+
connectionName: string;
|
|
45
|
+
/** Halo returned an article page. */
|
|
46
|
+
listed: StepTarget<QueryResult<OperationOutput>>;
|
|
47
|
+
/** Halo rejected the token or access. */
|
|
48
|
+
providerRejected?: StepTarget<QueryResult<OperationOutput>>;
|
|
49
|
+
/** Halo returned malformed or oversized data. */
|
|
50
|
+
invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
|
|
51
|
+
/** Local credentials or pagination are invalid. */
|
|
52
|
+
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
53
|
+
}
|
|
54
|
+
/** Build the listPosts Step from a named connection. */
|
|
55
|
+
declare function newListPostsStep<StepInput, OperationInput = ListPostsInput, OperationOutput = ListPostsOutput>(configuration: ListPostsStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
56
|
+
|
|
57
|
+
/** Open one named Fit2cloud connection from Dex project configuration. */
|
|
58
|
+
declare function newProjectConnection(project: LoadedProject, connectionName: string): Connection<Operations>;
|
|
59
|
+
|
|
60
|
+
/** Optional provider sender for local tests. */
|
|
61
|
+
interface Fit2cloudClientOptions {
|
|
62
|
+
/** Sender; omitted uses the SDK HTTP transport. */ send?: (request: ProviderRequest) => Promise<ProviderResponse>;
|
|
63
|
+
}
|
|
64
|
+
/** List article metadata authorized by a Halo personal access token. */
|
|
65
|
+
declare class Fit2cloudClient {
|
|
66
|
+
private readonly credentials;
|
|
67
|
+
private readonly baseUrl;
|
|
68
|
+
private readonly timeoutMs;
|
|
69
|
+
private readonly maxResponseBytes;
|
|
70
|
+
private readonly send;
|
|
71
|
+
/** Validate local settings without contacting Halo. */
|
|
72
|
+
constructor(config: Config, credentials: CredentialProvider<Credentials>, options?: Fit2cloudClientOptions);
|
|
73
|
+
/** Bind the article page Query. */ listPosts(): ListPostsOperation;
|
|
74
|
+
/** Send one bounded article page request. */
|
|
75
|
+
list(call: Call, page: number, pageSize: number): Promise<{
|
|
76
|
+
response?: ProviderResponse;
|
|
77
|
+
error?: 'credential' | 'transport' | 'tooLarge';
|
|
78
|
+
retryAfterMs: number;
|
|
79
|
+
}>;
|
|
80
|
+
}
|
|
81
|
+
/** Read one Halo article page. */
|
|
82
|
+
declare class ListPostsOperation implements Query<ListPostsInput, ListPostsOutput> {
|
|
83
|
+
private readonly client;
|
|
84
|
+
/** Bind the provider client. */ constructor(client: Fit2cloudClient);
|
|
85
|
+
/** Return the generated Query definition. */ definition(): QueryDefinition;
|
|
86
|
+
/** Classify one page using the Go connector contract. */
|
|
87
|
+
invoke(call: Call, input: ListPostsInput): Promise<QueryAttempt<ListPostsOutput>>;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { Config, Connection, ConnectorID, Credentials, Fit2cloudClient, type Fit2cloudClientOptions, ListPostsBranch, ListPostsBranchDefect, ListPostsBranchInvalidResponse, ListPostsBranchListed, ListPostsBranchProviderRejected, ListPostsDefinition, ListPostsInput, ListPostsMetadata, ListPostsOutput, type ListPostsStepConfig, ProviderID, newListPostsStep, newProjectConnection };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConfigSchema,
|
|
3
|
+
Connection,
|
|
4
|
+
ConnectorID,
|
|
5
|
+
CredentialMaterialError,
|
|
6
|
+
ListPostsBranch,
|
|
7
|
+
ListPostsBranchDefect,
|
|
8
|
+
ListPostsBranchInvalidResponse,
|
|
9
|
+
ListPostsBranchListed,
|
|
10
|
+
ListPostsBranchProviderRejected,
|
|
11
|
+
ListPostsDefinition,
|
|
12
|
+
ListPostsInputSchema,
|
|
13
|
+
ListPostsMetadata,
|
|
14
|
+
ListPostsOutputSchema,
|
|
15
|
+
PostSummarySchema,
|
|
16
|
+
ProviderID,
|
|
17
|
+
decodeCredentials,
|
|
18
|
+
isCredentialMaterialError,
|
|
19
|
+
newConnection,
|
|
20
|
+
newConnectionWithOperations,
|
|
21
|
+
newProjectConnection
|
|
22
|
+
} from "./chunk-ZCCJ5ZFA.js";
|
|
23
|
+
|
|
24
|
+
// src/generated/steps.ts
|
|
25
|
+
import { goToBranch, newQueryStep } from "@superdurable/connectors-sdk";
|
|
26
|
+
function newListPostsStep(configuration) {
|
|
27
|
+
const { connection, connectionName, listed, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
|
|
28
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
29
|
+
return newQueryStep({ ...stepConfiguration, operation: connection.operations.listPosts(), connection: connection.reference, branches: [
|
|
30
|
+
goToBranch("listed", listed),
|
|
31
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
32
|
+
...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
|
|
33
|
+
...defect ? [goToBranch("defect", defect)] : []
|
|
34
|
+
] });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/client.ts
|
|
38
|
+
import { SecretString, newQueryBranch, newQueryRetry } from "@superdurable/connectors-sdk";
|
|
39
|
+
import { BodyTooLargeError, parseRetryAfter, sendProviderRequest } from "@superdurable/connectors-sdk/providerhttp";
|
|
40
|
+
var postsPath = "/apis/content.halo.run/v1alpha1/posts";
|
|
41
|
+
var Fit2cloudClient = class {
|
|
42
|
+
/** Validate local settings without contacting Halo. */
|
|
43
|
+
constructor(config, credentials, options = {}) {
|
|
44
|
+
this.credentials = credentials;
|
|
45
|
+
if (!config || !credentials) throw new TypeError("Halo configuration and credentials are required");
|
|
46
|
+
this.timeoutMs = config.timeoutMs || 1e4;
|
|
47
|
+
this.maxResponseBytes = config.maxResponseBytes || 2097152;
|
|
48
|
+
if (!Number.isSafeInteger(this.timeoutMs) || this.timeoutMs <= 0 || !Number.isSafeInteger(this.maxResponseBytes) || this.maxResponseBytes <= 0 || this.maxResponseBytes > 16 << 20) throw new TypeError("Halo request limits are invalid");
|
|
49
|
+
let parsedUrl;
|
|
50
|
+
try {
|
|
51
|
+
parsedUrl = new URL(config.baseUrl);
|
|
52
|
+
} catch {
|
|
53
|
+
throw new TypeError("Halo baseUrl must be an HTTPS origin");
|
|
54
|
+
}
|
|
55
|
+
if (parsedUrl.protocol !== "https:" || !parsedUrl.hostname || parsedUrl.username || parsedUrl.password || parsedUrl.search || parsedUrl.hash || parsedUrl.pathname !== "/" && parsedUrl.pathname !== "" || parsedUrl.hostname === "localhost") throw new TypeError("Halo baseUrl must be an HTTPS origin");
|
|
56
|
+
this.baseUrl = parsedUrl.origin;
|
|
57
|
+
this.send = options.send ?? sendProviderRequest;
|
|
58
|
+
}
|
|
59
|
+
credentials;
|
|
60
|
+
baseUrl;
|
|
61
|
+
timeoutMs;
|
|
62
|
+
maxResponseBytes;
|
|
63
|
+
send;
|
|
64
|
+
/** Bind the article page Query. */
|
|
65
|
+
listPosts() {
|
|
66
|
+
return new ListPostsOperation(this);
|
|
67
|
+
}
|
|
68
|
+
/** Send one bounded article page request. */
|
|
69
|
+
async list(call, page, pageSize) {
|
|
70
|
+
let apiKey = "";
|
|
71
|
+
try {
|
|
72
|
+
const credentials = await this.credentials.resolve(call, call.context.cancellationSignal);
|
|
73
|
+
apiKey = credentials.apiKey instanceof SecretString ? credentials.apiKey.reveal() : "";
|
|
74
|
+
} catch {
|
|
75
|
+
return { error: "credential", retryAfterMs: 0 };
|
|
76
|
+
}
|
|
77
|
+
if (!apiKey.startsWith("pat_") || apiKey.length > 512 || /[^\x21-\x7e]/.test(apiKey)) return { error: "credential", retryAfterMs: 0 };
|
|
78
|
+
const query = new URLSearchParams({ page: String(page), size: String(pageSize) });
|
|
79
|
+
const request = { url: this.baseUrl + postsPath + "?" + query.toString(), method: "GET", headers: { Accept: "application/json", Authorization: `Bearer ${apiKey}` }, timeoutMs: this.timeoutMs, maxResponseBytes: this.maxResponseBytes, addressPolicy: "publicHTTPS", signal: call.context.cancellationSignal };
|
|
80
|
+
let response;
|
|
81
|
+
try {
|
|
82
|
+
response = await this.send(request);
|
|
83
|
+
} catch (error) {
|
|
84
|
+
if (error instanceof BodyTooLargeError && error.status !== void 0) return { response: { status: error.status, headers: error.headers ?? {}, body: new Uint8Array() }, error: "tooLarge", retryAfterMs: 0 };
|
|
85
|
+
return { error: "transport", retryAfterMs: 0 };
|
|
86
|
+
}
|
|
87
|
+
return { response, error: response.body.length > this.maxResponseBytes ? "tooLarge" : void 0, retryAfterMs: parseRetryAfter(header(response.headers, "retry-after")) };
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
var ListPostsOperation = class {
|
|
91
|
+
/** Bind the provider client. */
|
|
92
|
+
constructor(client) {
|
|
93
|
+
this.client = client;
|
|
94
|
+
}
|
|
95
|
+
client;
|
|
96
|
+
/** Return the generated Query definition. */
|
|
97
|
+
definition() {
|
|
98
|
+
return ListPostsDefinition;
|
|
99
|
+
}
|
|
100
|
+
/** Classify one page using the Go connector contract. */
|
|
101
|
+
async invoke(call, input) {
|
|
102
|
+
const selectedPage = input?.page ?? 0;
|
|
103
|
+
const selectedPageSize = input?.pageSize ?? 0;
|
|
104
|
+
const page = selectedPage || 1;
|
|
105
|
+
const pageSize = selectedPageSize || 20;
|
|
106
|
+
if (!Number.isSafeInteger(page) || !Number.isSafeInteger(pageSize) || page < 1 || page > 5e4 || pageSize < 1 || pageSize > 100) return branch("defect", "VALIDATION");
|
|
107
|
+
const exchange = await this.client.list(call, page, pageSize);
|
|
108
|
+
if (exchange.error === "credential") return branch("defect", "AUTHENTICATION");
|
|
109
|
+
if (exchange.error === "transport" || !exchange.response) return retry("AVAILABILITY");
|
|
110
|
+
const { status, body } = exchange.response;
|
|
111
|
+
if (status === 429) return retry("RATE_LIMIT", exchange.retryAfterMs);
|
|
112
|
+
if (status === 408 || status >= 500) return retry("AVAILABILITY", exchange.retryAfterMs);
|
|
113
|
+
if (exchange.error === "tooLarge") return branch("invalidResponse", "RESPONSE_TOO_LARGE");
|
|
114
|
+
if (status !== 200) return branch("providerRejected", status === 401 ? "AUTHENTICATION" : status === 403 ? "AUTHORIZATION" : "PROVIDER_REJECTION");
|
|
115
|
+
let wire;
|
|
116
|
+
try {
|
|
117
|
+
wire = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(body));
|
|
118
|
+
} catch {
|
|
119
|
+
wire = void 0;
|
|
120
|
+
}
|
|
121
|
+
const total = isObject(wire) ? wire.total ?? 0 : void 0;
|
|
122
|
+
if (!isObject(wire) || !Array.isArray(wire.items) || typeof wire.hasNext !== "boolean" || wire.page !== page || wire.size !== pageSize || typeof total !== "number" || !Number.isSafeInteger(total) || total < 0 || wire.items.length > pageSize) return branch("invalidResponse", "PROTOCOL");
|
|
123
|
+
const posts = [];
|
|
124
|
+
for (const item of wire.items) {
|
|
125
|
+
if (!isObject(item) || !isObject(item.metadata) || !isObject(item.spec)) return branch("invalidResponse", "PROTOCOL");
|
|
126
|
+
const { name } = item.metadata;
|
|
127
|
+
const { title, slug, publish, visible } = item.spec;
|
|
128
|
+
if (typeof name !== "string" || !name || name.length > 512 || typeof title !== "string" || !title || title.length > 1024 || typeof slug !== "string" || !slug || slug.length > 1024 || slug.trim() !== slug || publish !== void 0 && typeof publish !== "boolean" || !["PUBLIC", "INTERNAL", "PRIVATE"].includes(String(visible))) return branch("invalidResponse", "PROTOCOL");
|
|
129
|
+
posts.push({ name, title, slug, published: publish === true, visibility: visible });
|
|
130
|
+
}
|
|
131
|
+
if (wire.hasNext && page === 5e4) return branch("invalidResponse", "PROTOCOL");
|
|
132
|
+
return newQueryBranch("listed", { posts, nextPage: wire.hasNext ? page + 1 : 0 });
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
function isObject(value) {
|
|
136
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
137
|
+
}
|
|
138
|
+
function header(headers, name) {
|
|
139
|
+
const value = Object.entries(headers).find(([key]) => key.toLowerCase() === name)?.[1];
|
|
140
|
+
return Array.isArray(value) ? value[0] ?? "" : value ?? "";
|
|
141
|
+
}
|
|
142
|
+
function failure(kind) {
|
|
143
|
+
return { provider: "fit2cloud", operation: "listPosts", kind, message: "Halo article query failed" };
|
|
144
|
+
}
|
|
145
|
+
function branch(name, kind) {
|
|
146
|
+
return newQueryBranch(name, { posts: [], nextPage: 0 }, {}, failure(kind));
|
|
147
|
+
}
|
|
148
|
+
function retry(kind, delay = 0) {
|
|
149
|
+
return newQueryRetry(failure(kind), delay);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// src/project.ts
|
|
153
|
+
function newProjectConnection2(project, connectionName) {
|
|
154
|
+
return newProjectConnection(project, connectionName, (loadedProject, name) => {
|
|
155
|
+
const selected = loadedProject.configuration.connections.find((entry) => entry.connectorId === "fit2cloud" && entry.connectionName === name);
|
|
156
|
+
if (!selected) throw new TypeError("Fit2cloud project connection is not configured");
|
|
157
|
+
const fields = selected.configuration;
|
|
158
|
+
const config = ConfigSchema.parse({ ...fields, ...fields.timeout !== void 0 ? { timeoutMs: parseDurationMilliseconds(fields.timeout) } : {} });
|
|
159
|
+
const credentials = {
|
|
160
|
+
async resolve(_call, signal) {
|
|
161
|
+
return decodeCredentials(await loadedProject.resolveCredential("fit2cloud", name, signal));
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
return new Fit2cloudClient(config, credentials);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
function parseDurationMilliseconds(value) {
|
|
168
|
+
if (typeof value === "number") return Math.ceil(value / 1e6);
|
|
169
|
+
if (typeof value !== "string") throw new TypeError("timeout must be a duration");
|
|
170
|
+
let remaining = value;
|
|
171
|
+
let milliseconds = 0;
|
|
172
|
+
const units = { ns: 1e-6, us: 1e-3, "\xB5s": 1e-3, ms: 1, s: 1e3, m: 6e4, h: 36e5 };
|
|
173
|
+
while (remaining) {
|
|
174
|
+
const part = /^(\d+(?:\.\d+)?)(ns|us|µs|ms|s|m|h)/.exec(remaining);
|
|
175
|
+
if (!part) throw new TypeError("timeout must be a positive Go duration");
|
|
176
|
+
milliseconds += Number(part[1]) * (units[part[2] ?? ""] ?? NaN);
|
|
177
|
+
remaining = remaining.slice(part[0].length);
|
|
178
|
+
}
|
|
179
|
+
if (!Number.isSafeInteger(milliseconds) || milliseconds <= 0) throw new TypeError("timeout must resolve to positive whole milliseconds");
|
|
180
|
+
return milliseconds;
|
|
181
|
+
}
|
|
182
|
+
export {
|
|
183
|
+
ConfigSchema,
|
|
184
|
+
Connection,
|
|
185
|
+
ConnectorID,
|
|
186
|
+
CredentialMaterialError,
|
|
187
|
+
Fit2cloudClient,
|
|
188
|
+
ListPostsBranch,
|
|
189
|
+
ListPostsBranchDefect,
|
|
190
|
+
ListPostsBranchInvalidResponse,
|
|
191
|
+
ListPostsBranchListed,
|
|
192
|
+
ListPostsBranchProviderRejected,
|
|
193
|
+
ListPostsDefinition,
|
|
194
|
+
ListPostsInputSchema,
|
|
195
|
+
ListPostsMetadata,
|
|
196
|
+
ListPostsOutputSchema,
|
|
197
|
+
PostSummarySchema,
|
|
198
|
+
ProviderID,
|
|
199
|
+
decodeCredentials,
|
|
200
|
+
isCredentialMaterialError,
|
|
201
|
+
newConnection,
|
|
202
|
+
newConnectionWithOperations,
|
|
203
|
+
newListPostsStep,
|
|
204
|
+
newProjectConnection2 as newProjectConnection
|
|
205
|
+
};
|
package/dist/mock.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { MockQuery, Case } from '@superdurable/connectors-sdk/connectormock';
|
|
2
|
+
import { Failure } from '@superdurable/connectors-sdk';
|
|
3
|
+
import { O as Operations, C as Connection, L as ListPostsInput, a as ListPostsOutput, P as PostSummary } from './connection-DfpMBv8i.js';
|
|
4
|
+
import 'zod';
|
|
5
|
+
|
|
6
|
+
/** Go zero value for ListPostsInput in scripted cases. */
|
|
7
|
+
declare const emptyListPostsInput: ListPostsInput;
|
|
8
|
+
/** Go zero value for PostSummary in scripted cases. */
|
|
9
|
+
declare const emptyPostSummary: PostSummary;
|
|
10
|
+
/** Go zero value for ListPostsOutput in scripted cases. */
|
|
11
|
+
declare const emptyListPostsOutput: ListPostsOutput;
|
|
12
|
+
/** Script the listed branch. */
|
|
13
|
+
declare function listPostsListed(value: ListPostsOutput, failure?: Failure): Case<ListPostsOutput>;
|
|
14
|
+
/** Script the providerRejected branch. */
|
|
15
|
+
declare function listPostsProviderRejected(value: ListPostsOutput, failure?: Failure): Case<ListPostsOutput>;
|
|
16
|
+
/** Script the invalidResponse branch. */
|
|
17
|
+
declare function listPostsInvalidResponse(value: ListPostsOutput, failure?: Failure): Case<ListPostsOutput>;
|
|
18
|
+
/** Script the defect branch. */
|
|
19
|
+
declare function listPostsDefect(value: ListPostsOutput, failure?: Failure): Case<ListPostsOutput>;
|
|
20
|
+
/** Script a safe retry of listPosts. */
|
|
21
|
+
declare function listPostsRetry(failure: Failure, retryAfterMs?: number): Case<ListPostsOutput>;
|
|
22
|
+
/** Manifest scenario samplePosts for listPosts. */
|
|
23
|
+
declare function listPostsSamplePosts(): Case<ListPostsOutput>;
|
|
24
|
+
/** Default listPosts scenario. */
|
|
25
|
+
declare function listPostsDefault(): Case<ListPostsOutput>;
|
|
26
|
+
/** Scripted operations and manifest defaults for this connector. */
|
|
27
|
+
declare class GeneratedMock implements Operations {
|
|
28
|
+
#private;
|
|
29
|
+
constructor(connectionName: string);
|
|
30
|
+
connection(): Connection;
|
|
31
|
+
listPosts(): MockQuery<ListPostsInput, ListPostsOutput>;
|
|
32
|
+
assertNoFailures(): void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { GeneratedMock, emptyListPostsInput, emptyListPostsOutput, emptyPostSummary, listPostsDefault, listPostsDefect, listPostsInvalidResponse, listPostsListed, listPostsProviderRejected, listPostsRetry, listPostsSamplePosts };
|
package/dist/mock.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ListPostsDefinition,
|
|
3
|
+
ListPostsInputSchema,
|
|
4
|
+
ListPostsOutputSchema,
|
|
5
|
+
PostSummarySchema,
|
|
6
|
+
ProviderID,
|
|
7
|
+
newConnectionWithOperations
|
|
8
|
+
} from "./chunk-ZCCJ5ZFA.js";
|
|
9
|
+
|
|
10
|
+
// src/generated/mock.ts
|
|
11
|
+
import { branchCase, retryCase, newQuery } from "@superdurable/connectors-sdk/connectormock";
|
|
12
|
+
var emptyListPostsInput = ListPostsInputSchema.parse({
|
|
13
|
+
"page": 0,
|
|
14
|
+
"pageSize": 0
|
|
15
|
+
});
|
|
16
|
+
var emptyPostSummary = PostSummarySchema.parse({
|
|
17
|
+
"name": "",
|
|
18
|
+
"title": "",
|
|
19
|
+
"slug": "",
|
|
20
|
+
"published": false,
|
|
21
|
+
"visibility": ""
|
|
22
|
+
});
|
|
23
|
+
var emptyListPostsOutput = ListPostsOutputSchema.parse({
|
|
24
|
+
"posts": [],
|
|
25
|
+
"nextPage": 0
|
|
26
|
+
});
|
|
27
|
+
function listPostsListed(value, failure) {
|
|
28
|
+
return branchCase("listed", value, failure);
|
|
29
|
+
}
|
|
30
|
+
function listPostsProviderRejected(value, failure) {
|
|
31
|
+
return branchCase("providerRejected", value, failure);
|
|
32
|
+
}
|
|
33
|
+
function listPostsInvalidResponse(value, failure) {
|
|
34
|
+
return branchCase("invalidResponse", value, failure);
|
|
35
|
+
}
|
|
36
|
+
function listPostsDefect(value, failure) {
|
|
37
|
+
return branchCase("defect", value, failure);
|
|
38
|
+
}
|
|
39
|
+
function listPostsRetry(failure, retryAfterMs = 0) {
|
|
40
|
+
return retryCase(failure, retryAfterMs);
|
|
41
|
+
}
|
|
42
|
+
function listPostsSamplePosts() {
|
|
43
|
+
const value = ListPostsOutputSchema.parse({ "nextPage": 0, "posts": [{ "name": "example-post", "published": true, "slug": "example-post", "title": "Example Post", "visibility": "PUBLIC" }] });
|
|
44
|
+
return branchCase("listed", value);
|
|
45
|
+
}
|
|
46
|
+
function listPostsDefault() {
|
|
47
|
+
return listPostsSamplePosts();
|
|
48
|
+
}
|
|
49
|
+
var GeneratedMock = class {
|
|
50
|
+
#listPosts;
|
|
51
|
+
#connection;
|
|
52
|
+
constructor(connectionName) {
|
|
53
|
+
this.#listPosts = newQuery(ListPostsDefinition).default(listPostsDefault());
|
|
54
|
+
this.#connection = newConnectionWithOperations(this, { provider: ProviderID, name: connectionName });
|
|
55
|
+
}
|
|
56
|
+
connection() {
|
|
57
|
+
return this.#connection;
|
|
58
|
+
}
|
|
59
|
+
listPosts() {
|
|
60
|
+
return this.#listPosts;
|
|
61
|
+
}
|
|
62
|
+
assertNoFailures() {
|
|
63
|
+
this.#listPosts.assertNoFailures();
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
export {
|
|
67
|
+
GeneratedMock,
|
|
68
|
+
emptyListPostsInput,
|
|
69
|
+
emptyListPostsOutput,
|
|
70
|
+
emptyPostSummary,
|
|
71
|
+
listPostsDefault,
|
|
72
|
+
listPostsDefect,
|
|
73
|
+
listPostsInvalidResponse,
|
|
74
|
+
listPostsListed,
|
|
75
|
+
listPostsProviderRejected,
|
|
76
|
+
listPostsRetry,
|
|
77
|
+
listPostsSamplePosts
|
|
78
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,61 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdurable/connector-fit2cloud",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "fit2cloud connector for Dex TypeScript applications",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/superdurable/dex-connectors-library.git",
|
|
9
|
+
"directory": "connectors/fit2cloud/typescript"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": "^22.0.0 || ^24.0.0"
|
|
14
|
+
},
|
|
15
|
+
"module": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./mock": {
|
|
23
|
+
"types": "./dist/mock.d.ts",
|
|
24
|
+
"import": "./dist/mock.js"
|
|
25
|
+
},
|
|
26
|
+
"./dex-connector.json": "./dex-connector.json"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"README.md",
|
|
31
|
+
"LICENSE",
|
|
32
|
+
"dex-connector.json"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"prepack": "npm run build",
|
|
36
|
+
"build": "tsup src/index.ts src/mock.ts --format esm --dts --clean",
|
|
37
|
+
"typecheck": "tsc --noEmit",
|
|
38
|
+
"lint": "eslint src test examples",
|
|
39
|
+
"test": "vitest run --exclude test/integration/**",
|
|
40
|
+
"test:integration": "vitest run test/integration/*.integration.test.ts",
|
|
41
|
+
"example:worker": "tsx examples/basic/worker.ts",
|
|
42
|
+
"example:start": "tsx examples/basic/start.ts",
|
|
43
|
+
"check": "npm run typecheck && npm run lint && npm test && npm run build"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@superdurable/connectors-sdk": "0.1.1",
|
|
47
|
+
"@superdurable/dex": ">=1.28.0",
|
|
48
|
+
"zod": "^4.1.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@eslint/js": "^9.0.0",
|
|
52
|
+
"@types/node": "^22.0.0",
|
|
53
|
+
"eslint": "^9.0.0",
|
|
54
|
+
"tsup": "^8.0.0",
|
|
55
|
+
"tsx": "^4.23.15",
|
|
56
|
+
"typescript": "^5.9.0",
|
|
57
|
+
"typescript-eslint": "^8.0.0",
|
|
58
|
+
"vitest": "^3.0.0",
|
|
59
|
+
"yaml": "^2.9.1"
|
|
60
|
+
}
|
|
61
|
+
}
|