@superdurable/connector-shopify 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 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,25 @@
1
- # Temporary Holding Version
1
+ # Shopify connector for TypeScript
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Install `@superdurable/connector-shopify@0.1.0`. This package provides the
4
+ `newGetOrderStep` and `newListOrdersStep` Query factories, typed models, a named
5
+ connection, and manifest-generated mocks. The happy branches are `found` and
6
+ `listed`; `notFound`, `providerRejected`, `invalidResponse`, and `defect` are
7
+ optional and fail an unwired Flow.
8
+
9
+ The client reads `https://<shopSubdomain>.myshopify.com/admin/api/2026-10`.
10
+ `getOrder` requires a positive numeric order ID. `listOrders` requests
11
+ `status=any` and accepts a limit from 1 through 250; zero uses Shopify's
12
+ default. HTTP 408, 429, 5xx, and transport failures retry. Credentials are
13
+ resolved for each attempt and sent only in `X-Shopify-Access-Token`.
14
+
15
+ Create a private Dex Web connection named `shopify-orders` with the fields in
16
+ the [manifest authorization guide](../README.md#authentication-and-configuration).
17
+ The `timeout` setting is a positive Go duration; the TypeScript client converts
18
+ it to milliseconds. Blank `timeout` and `maxResponseBytes` use manifest defaults.
19
+
20
+ The [runnable order read example](examples/order-read/README.md) is the
21
+ consuming application. Run `npm ci && npm run check` in this directory for
22
+ the package and Go-recorded provider conformance tests. Run the example's
23
+ integration test against `dexcli dev` to verify a real Worker, Client, and
24
+ unwired rejection. Live Shopify authorization and provider behavior have not
25
+ been verified.
@@ -0,0 +1,87 @@
1
+ {
2
+ "connectorId": "shopify",
3
+ "releaseTag": "connectors/shopify/go/v0.2.0",
4
+ "package": {
5
+ "ecosystem": "npm",
6
+ "name": "@superdurable/connector-shopify",
7
+ "version": "0.1.0"
8
+ },
9
+ "factories": [
10
+ {
11
+ "name": "newGetOrderStep",
12
+ "kind": "query",
13
+ "operationId": "getOrder",
14
+ "fields": {
15
+ "stepType": "stepType",
16
+ "annotations": "annotations",
17
+ "connectionName": "connectionName",
18
+ "resultAttribute": "resultAttribute"
19
+ },
20
+ "branches": [
21
+ {
22
+ "id": "found",
23
+ "field": "found",
24
+ "optional": false
25
+ },
26
+ {
27
+ "id": "notFound",
28
+ "field": "notFound",
29
+ "optional": true
30
+ },
31
+ {
32
+ "id": "providerRejected",
33
+ "field": "providerRejected",
34
+ "optional": true
35
+ },
36
+ {
37
+ "id": "invalidResponse",
38
+ "field": "invalidResponse",
39
+ "optional": true
40
+ },
41
+ {
42
+ "id": "defect",
43
+ "field": "defect",
44
+ "optional": true
45
+ }
46
+ ]
47
+ },
48
+ {
49
+ "name": "newListOrdersStep",
50
+ "kind": "query",
51
+ "operationId": "listOrders",
52
+ "fields": {
53
+ "stepType": "stepType",
54
+ "annotations": "annotations",
55
+ "connectionName": "connectionName",
56
+ "resultAttribute": "resultAttribute"
57
+ },
58
+ "branches": [
59
+ {
60
+ "id": "listed",
61
+ "field": "listed",
62
+ "optional": false
63
+ },
64
+ {
65
+ "id": "notFound",
66
+ "field": "notFound",
67
+ "optional": true
68
+ },
69
+ {
70
+ "id": "providerRejected",
71
+ "field": "providerRejected",
72
+ "optional": true
73
+ },
74
+ {
75
+ "id": "invalidResponse",
76
+ "field": "invalidResponse",
77
+ "optional": true
78
+ },
79
+ {
80
+ "id": "defect",
81
+ "field": "defect",
82
+ "optional": true
83
+ }
84
+ ]
85
+ }
86
+ ]
87
+ }
@@ -0,0 +1,135 @@
1
+ // src/generated/models.ts
2
+ import { z } from "zod";
3
+ var ConfigSchema = z.object({
4
+ "shopSubdomain": z.string(),
5
+ "timeoutMs": z.number().int().optional(),
6
+ "maxResponseBytes": z.number().int().optional()
7
+ });
8
+ var GetOrderInputSchema = z.strictObject({
9
+ "orderId": z.number().int()
10
+ });
11
+ var OrderSchema = z.strictObject({
12
+ "id": z.number().int(),
13
+ "name": z.string(),
14
+ "financial_status": z.string(),
15
+ "total_price": z.string(),
16
+ "currency": z.string()
17
+ });
18
+ var ListOrdersInputSchema = z.strictObject({
19
+ "limit": z.number().int().optional()
20
+ });
21
+ var OrderPageSchema = z.strictObject({
22
+ "orders": z.array(OrderSchema).nullable()
23
+ });
24
+
25
+ // src/generated/definitions.ts
26
+ var ConnectorID = "shopify";
27
+ var ProviderID = "shopify";
28
+ var GetOrderBranch = {
29
+ Found: "found",
30
+ NotFound: "notFound",
31
+ ProviderRejected: "providerRejected",
32
+ InvalidResponse: "invalidResponse",
33
+ Defect: "defect"
34
+ };
35
+ var GetOrderBranchFound = GetOrderBranch.Found;
36
+ var GetOrderBranchNotFound = GetOrderBranch.NotFound;
37
+ var GetOrderBranchProviderRejected = GetOrderBranch.ProviderRejected;
38
+ var GetOrderBranchInvalidResponse = GetOrderBranch.InvalidResponse;
39
+ var GetOrderBranchDefect = GetOrderBranch.Defect;
40
+ var GetOrderDefinition = {
41
+ operation: { connectorId: ConnectorID, operationId: "getOrder" },
42
+ branches: [
43
+ { id: "found", description: "Read one Shopify order." },
44
+ { id: "notFound", description: "The requested resource was not found.", optional: true },
45
+ { id: "providerRejected", description: "The provider conclusively rejected the request.", optional: true },
46
+ { id: "invalidResponse", description: "The provider returned malformed or oversized JSON.", optional: true },
47
+ { id: "defect", description: "Local input or connection credentials are invalid.", optional: true }
48
+ ],
49
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
50
+ };
51
+ var GetOrderMetadata = { kind: "query", idempotency: "none", authorization: "required" };
52
+ var ListOrdersBranch = {
53
+ Listed: "listed",
54
+ NotFound: "notFound",
55
+ ProviderRejected: "providerRejected",
56
+ InvalidResponse: "invalidResponse",
57
+ Defect: "defect"
58
+ };
59
+ var ListOrdersBranchListed = ListOrdersBranch.Listed;
60
+ var ListOrdersBranchNotFound = ListOrdersBranch.NotFound;
61
+ var ListOrdersBranchProviderRejected = ListOrdersBranch.ProviderRejected;
62
+ var ListOrdersBranchInvalidResponse = ListOrdersBranch.InvalidResponse;
63
+ var ListOrdersBranchDefect = ListOrdersBranch.Defect;
64
+ var ListOrdersDefinition = {
65
+ operation: { connectorId: ConnectorID, operationId: "listOrders" },
66
+ branches: [
67
+ { id: "listed", description: "List one page of Shopify orders." },
68
+ { id: "notFound", description: "The requested resource was not found.", optional: true },
69
+ { id: "providerRejected", description: "The provider conclusively rejected the request.", optional: true },
70
+ { id: "invalidResponse", description: "The provider returned malformed or oversized JSON.", optional: true },
71
+ { id: "defect", description: "Local input or connection credentials are invalid.", optional: true }
72
+ ],
73
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
74
+ };
75
+ var ListOrdersMetadata = { kind: "query", idempotency: "none", authorization: "required" };
76
+
77
+ // src/generated/connection.ts
78
+ import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
79
+ var Connection = class {
80
+ /** Stable provider and connection name. */
81
+ reference;
82
+ /** Bound provider operations. */
83
+ operations;
84
+ /** Validate a reference and bind operations. */
85
+ constructor(reference, operations) {
86
+ this.reference = ConnectionRefSchema.parse(reference);
87
+ if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
88
+ if (!operations) throw new TypeError("connector operations are required");
89
+ this.operations = operations;
90
+ }
91
+ };
92
+ function newConnection(client, reference) {
93
+ if (!client) throw new TypeError("connector client is required");
94
+ return new Connection(reference, client);
95
+ }
96
+ function newConnectionWithOperations(operations, reference) {
97
+ return new Connection(reference, operations);
98
+ }
99
+ function newProjectConnection(project, connectionName, createClient) {
100
+ if (!project) throw new TypeError("loaded project is required");
101
+ const reference = ConnectionRefSchema.parse({ provider: ProviderID, name: connectionName });
102
+ const selected = project.configuration.connections.find((entry) => entry.connectorId === ConnectorID && entry.connectionName === connectionName);
103
+ if (!selected || selected.provider !== ProviderID) throw new TypeError("project connection is not configured");
104
+ return newConnection(createClient(project, connectionName), reference);
105
+ }
106
+
107
+ export {
108
+ ConfigSchema,
109
+ GetOrderInputSchema,
110
+ OrderSchema,
111
+ ListOrdersInputSchema,
112
+ OrderPageSchema,
113
+ ConnectorID,
114
+ ProviderID,
115
+ GetOrderBranch,
116
+ GetOrderBranchFound,
117
+ GetOrderBranchNotFound,
118
+ GetOrderBranchProviderRejected,
119
+ GetOrderBranchInvalidResponse,
120
+ GetOrderBranchDefect,
121
+ GetOrderDefinition,
122
+ GetOrderMetadata,
123
+ ListOrdersBranch,
124
+ ListOrdersBranchListed,
125
+ ListOrdersBranchNotFound,
126
+ ListOrdersBranchProviderRejected,
127
+ ListOrdersBranchInvalidResponse,
128
+ ListOrdersBranchDefect,
129
+ ListOrdersDefinition,
130
+ ListOrdersMetadata,
131
+ Connection,
132
+ newConnection,
133
+ newConnectionWithOperations,
134
+ newProjectConnection
135
+ };
@@ -0,0 +1,102 @@
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
+ /** Non-secret Shopify shop subdomain: the acme in https://acme.myshopify.com. At https://admin.shopify.com > Settings > Domains, find the myshopify.com domain and enter only the part before .myshopify.com, using lowercase letters, digits, and hyphens. Required; blank cannot identify a store. The connector appends /admin/api/2026-10. */
7
+ shopSubdomain: string;
8
+ /** Maximum duration of one provider HTTP request as a positive Go duration, such as 15s or 1m. Blank uses the displayed default; override for slow network paths. Runtime value in milliseconds. */
9
+ timeoutMs?: number;
10
+ /** Maximum provider JSON response size in bytes as a positive integer. Blank uses the displayed default; raise only for larger result pages. */
11
+ maxResponseBytes?: number;
12
+ }
13
+ /** Runtime schema for manifest configuration. */
14
+ declare const ConfigSchema: z.ZodObject<{
15
+ shopSubdomain: 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
+ /** Secret Admin API access token of an existing admin-created custom app at https://admin.shopify.com > Settings > Apps and sales channels > Develop apps > the app > API credentials. It is an opaque token sent only in X-Shopify-Access-Token. Blank prevents calls. New admin-created custom apps are unavailable. */
22
+ accessToken: SecretString;
23
+ }
24
+ /** Host-owned source of private connector credentials. */
25
+ type CredentialSource = CredentialProvider<Credentials>;
26
+ /** GetOrderInput identifies one Shopify order. */
27
+ interface GetOrderInput {
28
+ /** OrderID is the numeric Shopify order ID. */
29
+ "orderId": number;
30
+ }
31
+ /** Order is a minimal Shopify order summary; protected customer data is omitted. */
32
+ interface Order {
33
+ /** ID is the numeric Shopify order ID. */
34
+ "id": number;
35
+ /** Name is the human-readable order number. */
36
+ "name": string;
37
+ /** FinancialStatus is the payment state. */
38
+ "financial_status": string;
39
+ /** TotalPrice is the decimal order total. */
40
+ "total_price": string;
41
+ /** Currency is the ISO currency code. */
42
+ "currency": string;
43
+ }
44
+ /** ListOrdersInput selects one bounded page of Shopify orders. */
45
+ interface ListOrdersInput {
46
+ /** Limit bounds one page from 1 through 250; zero uses Shopify default. */
47
+ "limit"?: number | undefined;
48
+ }
49
+ /** OrderPage contains one Shopify order page. */
50
+ interface OrderPage {
51
+ /** Orders contains the returned orders, possibly none. */
52
+ "orders": Array<Order> | null;
53
+ }
54
+ /** Runtime validator for GetOrderInput. */
55
+ declare const GetOrderInputSchema: z.ZodObject<{
56
+ orderId: z.ZodNumber;
57
+ }, z.core.$strict>;
58
+ /** Runtime validator for Order. */
59
+ declare const OrderSchema: z.ZodObject<{
60
+ id: z.ZodNumber;
61
+ name: z.ZodString;
62
+ financial_status: z.ZodString;
63
+ total_price: z.ZodString;
64
+ currency: z.ZodString;
65
+ }, z.core.$strict>;
66
+ /** Runtime validator for ListOrdersInput. */
67
+ declare const ListOrdersInputSchema: z.ZodObject<{
68
+ limit: z.ZodOptional<z.ZodNumber>;
69
+ }, z.core.$strict>;
70
+ /** Runtime validator for OrderPage. */
71
+ declare const OrderPageSchema: z.ZodObject<{
72
+ orders: z.ZodNullable<z.ZodArray<z.ZodObject<{
73
+ id: z.ZodNumber;
74
+ name: z.ZodString;
75
+ financial_status: z.ZodString;
76
+ total_price: z.ZodString;
77
+ currency: z.ZodString;
78
+ }, z.core.$strict>>>;
79
+ }, z.core.$strict>;
80
+
81
+ /** Typed operations supplied by a client or mock. */
82
+ interface Operations {
83
+ /** Invoke getOrder through this connection. */
84
+ getOrder(): Query<GetOrderInput, Order>;
85
+ /** Invoke listOrders through this connection. */
86
+ listOrders(): Query<ListOrdersInput, OrderPage>;
87
+ }
88
+ /** Named connector connection kept outside Flow state. */
89
+ declare class Connection<BoundOperations = Operations> {
90
+ /** Stable provider and connection name. */
91
+ readonly reference: ConnectionRef;
92
+ /** Bound provider operations. */
93
+ readonly operations: BoundOperations;
94
+ /** Validate a reference and bind operations. */
95
+ constructor(reference: ConnectionRef, operations: BoundOperations);
96
+ }
97
+ /** Bind a client to a named connection. */
98
+ declare function newConnection(client: Operations, reference: ConnectionRef): Connection;
99
+ /** Bind scripted operations to a named connection. */
100
+ declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
101
+
102
+ export { Connection as C, type GetOrderInput as G, type ListOrdersInput as L, type Order as O, type OrderPage as a, type Config as b, type Credentials as c, type Operations as d, ConfigSchema as e, type CredentialSource as f, GetOrderInputSchema as g, ListOrdersInputSchema as h, OrderPageSchema as i, OrderSchema as j, newConnectionWithOperations as k, newConnection as n };
@@ -0,0 +1,171 @@
1
+ import { G as GetOrderInput, O as Order, C as Connection, L as ListOrdersInput, a as OrderPage, b as Config, c as Credentials, d as Operations } from './connection-D5oSVoU-.js';
2
+ export { e as ConfigSchema, f as CredentialSource, g as GetOrderInputSchema, h as ListOrdersInputSchema, i as OrderPageSchema, j as OrderSchema, n as newConnection, k as newConnectionWithOperations } from './connection-D5oSVoU-.js';
3
+ import * as _superdurable_connectors_sdk from '@superdurable/connectors-sdk';
4
+ import { QueryDefinition, QueryStepConfig, Query, QueryResult, QueryStep, Call, QueryAttempt, CredentialProvider, Failure } from '@superdurable/connectors-sdk';
5
+ import { StepTarget } from '@superdurable/dex';
6
+ import { ProviderRequest, ProviderResponse } from '@superdurable/connectors-sdk/providerhttp';
7
+ import { LoadedProject } from '@superdurable/connectors-sdk/projectconfig';
8
+ import 'zod';
9
+
10
+ /** Stable connector identity. */
11
+ declare const ConnectorID = "shopify";
12
+ /** Provider identity for named connections. */
13
+ declare const ProviderID = "shopify";
14
+ /** Branch IDs for getOrder. */
15
+ declare const GetOrderBranch: {
16
+ readonly Found: "found";
17
+ readonly NotFound: "notFound";
18
+ readonly ProviderRejected: "providerRejected";
19
+ readonly InvalidResponse: "invalidResponse";
20
+ readonly Defect: "defect";
21
+ };
22
+ /** Read one Shopify order. */
23
+ declare const GetOrderBranchFound: "found";
24
+ /** The requested resource was not found. */
25
+ declare const GetOrderBranchNotFound: "notFound";
26
+ /** The provider conclusively rejected the request. */
27
+ declare const GetOrderBranchProviderRejected: "providerRejected";
28
+ /** The provider returned malformed or oversized JSON. */
29
+ declare const GetOrderBranchInvalidResponse: "invalidResponse";
30
+ /** Local input or connection credentials are invalid. */
31
+ declare const GetOrderBranchDefect: "defect";
32
+ /** Manifest definition for getOrder. */
33
+ declare const GetOrderDefinition: QueryDefinition;
34
+ /** Manifest metadata for getOrder. */
35
+ declare const GetOrderMetadata: {
36
+ readonly kind: "query";
37
+ readonly idempotency: "none";
38
+ readonly authorization: "required";
39
+ };
40
+ /** Branch IDs for listOrders. */
41
+ declare const ListOrdersBranch: {
42
+ readonly Listed: "listed";
43
+ readonly NotFound: "notFound";
44
+ readonly ProviderRejected: "providerRejected";
45
+ readonly InvalidResponse: "invalidResponse";
46
+ readonly Defect: "defect";
47
+ };
48
+ /** List one page of Shopify orders. */
49
+ declare const ListOrdersBranchListed: "listed";
50
+ /** The requested resource was not found. */
51
+ declare const ListOrdersBranchNotFound: "notFound";
52
+ /** The provider conclusively rejected the request. */
53
+ declare const ListOrdersBranchProviderRejected: "providerRejected";
54
+ /** The provider returned malformed or oversized JSON. */
55
+ declare const ListOrdersBranchInvalidResponse: "invalidResponse";
56
+ /** Local input or connection credentials are invalid. */
57
+ declare const ListOrdersBranchDefect: "defect";
58
+ /** Manifest definition for listOrders. */
59
+ declare const ListOrdersDefinition: QueryDefinition;
60
+ /** Manifest metadata for listOrders. */
61
+ declare const ListOrdersMetadata: {
62
+ readonly kind: "query";
63
+ readonly idempotency: "none";
64
+ readonly authorization: "required";
65
+ };
66
+
67
+ /** Configuration for the getOrder connector Step. */
68
+ interface GetOrderStepConfig<StepInput, OperationInput = GetOrderInput, OperationOutput = Order> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
69
+ /** Named connection supplying this operation. */
70
+ connection: Connection<{
71
+ getOrder(): Query<OperationInput, OperationOutput>;
72
+ }>;
73
+ /** Name matching the bound connection. */
74
+ connectionName: string;
75
+ /** Read one Shopify order. */
76
+ found: StepTarget<QueryResult<OperationOutput>>;
77
+ /** The requested resource was not found. */
78
+ notFound?: StepTarget<QueryResult<OperationOutput>>;
79
+ /** The provider conclusively rejected the request. */
80
+ providerRejected?: StepTarget<QueryResult<OperationOutput>>;
81
+ /** The provider returned malformed or oversized JSON. */
82
+ invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
83
+ /** Local input or connection credentials are invalid. */
84
+ defect?: StepTarget<QueryResult<OperationOutput>>;
85
+ }
86
+ /** Build the getOrder Step from a named connection. */
87
+ declare function newGetOrderStep<StepInput, OperationInput = GetOrderInput, OperationOutput = Order>(configuration: GetOrderStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
88
+ /** Configuration for the listOrders connector Step. */
89
+ interface ListOrdersStepConfig<StepInput, OperationInput = ListOrdersInput, OperationOutput = OrderPage> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
90
+ /** Named connection supplying this operation. */
91
+ connection: Connection<{
92
+ listOrders(): Query<OperationInput, OperationOutput>;
93
+ }>;
94
+ /** Name matching the bound connection. */
95
+ connectionName: string;
96
+ /** List one page of Shopify orders. */
97
+ listed: StepTarget<QueryResult<OperationOutput>>;
98
+ /** The requested resource was not found. */
99
+ notFound?: StepTarget<QueryResult<OperationOutput>>;
100
+ /** The provider conclusively rejected the request. */
101
+ providerRejected?: StepTarget<QueryResult<OperationOutput>>;
102
+ /** The provider returned malformed or oversized JSON. */
103
+ invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
104
+ /** Local input or connection credentials are invalid. */
105
+ defect?: StepTarget<QueryResult<OperationOutput>>;
106
+ }
107
+ /** Build the listOrders Step from a named connection. */
108
+ declare function newListOrdersStep<StepInput, OperationInput = ListOrdersInput, OperationOutput = OrderPage>(configuration: ListOrdersStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
109
+
110
+ /** Read one Shopify order. */
111
+ declare class GetOrderOperation implements Query<GetOrderInput, Order> {
112
+ private readonly client;
113
+ /** Bind the validated client. */ constructor(client: ShopifyClient);
114
+ /** Return the manifest operation definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
115
+ /** Validate and read one order. */
116
+ invoke(call: Call, input: GetOrderInput): Promise<QueryAttempt<Order>>;
117
+ }
118
+ /** Read one bounded Shopify order page. */
119
+ declare class ListOrdersOperation implements Query<ListOrdersInput, OrderPage> {
120
+ private readonly client;
121
+ /** Bind the validated client. */ constructor(client: ShopifyClient);
122
+ /** Return the manifest operation definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
123
+ /** Validate and read one page. */
124
+ invoke(call: Call, input: ListOrdersInput): Promise<QueryAttempt<OrderPage>>;
125
+ }
126
+
127
+ /** Injectable HTTP sender for provider replay. */
128
+ type ShopifyRequestSender = (request: ProviderRequest) => Promise<ProviderResponse>;
129
+ /** Transport dependency for deterministic tests. */
130
+ interface ShopifyClientOptions {
131
+ /** Override the default bounded HTTP sender. */
132
+ send?: ShopifyRequestSender;
133
+ }
134
+ /** One classified provider exchange. */
135
+ interface ShopifyExchangeFailure {
136
+ /** Retry or a manifest branch. */
137
+ branch: 'retry' | 'notFound' | 'providerRejected' | 'invalidResponse' | 'defect';
138
+ /** Secret-safe failure. */
139
+ failure: Failure;
140
+ /** Provider delay in milliseconds. */
141
+ retryAfterMs: number;
142
+ }
143
+ /** Bounded successful body or classified failure. */
144
+ type ShopifyExchangeResult = {
145
+ body: Uint8Array;
146
+ } | {
147
+ outcome: ShopifyExchangeFailure;
148
+ };
149
+ /** Validated Shopify order client with call-time credential resolution. */
150
+ declare class ShopifyClient {
151
+ private readonly baseURL;
152
+ private readonly timeoutMs;
153
+ private readonly maxResponseBytes;
154
+ private readonly credentials;
155
+ private readonly send;
156
+ /** Validate one shop connection without contacting Shopify. */
157
+ constructor(config: Config, credentials: CredentialProvider<Credentials>, options?: ShopifyClientOptions);
158
+ /** Bind one order lookup. */
159
+ getOrder(): GetOrderOperation;
160
+ /** Bind one order page lookup. */
161
+ listOrders(): ListOrdersOperation;
162
+ /** Send one order read and apply Go's status classification. */
163
+ read(call: Call, operation: string, path: string, query?: URLSearchParams): Promise<ShopifyExchangeResult>;
164
+ private classifyStatus;
165
+ private failure;
166
+ }
167
+
168
+ /** Open a named Shopify connection from a Dex project. */
169
+ declare function newProjectConnection(project: LoadedProject, connectionName: string, options?: ShopifyClientOptions): Connection<Operations>;
170
+
171
+ export { Config, Connection, ConnectorID, Credentials, GetOrderBranch, GetOrderBranchDefect, GetOrderBranchFound, GetOrderBranchInvalidResponse, GetOrderBranchNotFound, GetOrderBranchProviderRejected, GetOrderDefinition, GetOrderInput, GetOrderMetadata, GetOrderOperation, type GetOrderStepConfig, ListOrdersBranch, ListOrdersBranchDefect, ListOrdersBranchInvalidResponse, ListOrdersBranchListed, ListOrdersBranchNotFound, ListOrdersBranchProviderRejected, ListOrdersDefinition, ListOrdersInput, ListOrdersMetadata, ListOrdersOperation, type ListOrdersStepConfig, Order, OrderPage, ProviderID, ShopifyClient, type ShopifyClientOptions, type ShopifyRequestSender, newGetOrderStep, newListOrdersStep, newProjectConnection };
package/dist/index.js ADDED
@@ -0,0 +1,292 @@
1
+ import {
2
+ ConfigSchema,
3
+ Connection,
4
+ ConnectorID,
5
+ GetOrderBranch,
6
+ GetOrderBranchDefect,
7
+ GetOrderBranchFound,
8
+ GetOrderBranchInvalidResponse,
9
+ GetOrderBranchNotFound,
10
+ GetOrderBranchProviderRejected,
11
+ GetOrderDefinition,
12
+ GetOrderInputSchema,
13
+ GetOrderMetadata,
14
+ ListOrdersBranch,
15
+ ListOrdersBranchDefect,
16
+ ListOrdersBranchInvalidResponse,
17
+ ListOrdersBranchListed,
18
+ ListOrdersBranchNotFound,
19
+ ListOrdersBranchProviderRejected,
20
+ ListOrdersDefinition,
21
+ ListOrdersInputSchema,
22
+ ListOrdersMetadata,
23
+ OrderPageSchema,
24
+ OrderSchema,
25
+ ProviderID,
26
+ newConnection,
27
+ newConnectionWithOperations,
28
+ newProjectConnection
29
+ } from "./chunk-A5SY2SHU.js";
30
+
31
+ // src/generated/steps.ts
32
+ import { goToBranch, newQueryStep } from "@superdurable/connectors-sdk";
33
+ function newGetOrderStep(configuration) {
34
+ const { connection, connectionName, found, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
35
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
36
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.getOrder(), connection: connection.reference, branches: [
37
+ goToBranch("found", found),
38
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
39
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
40
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
41
+ ...defect ? [goToBranch("defect", defect)] : []
42
+ ] });
43
+ }
44
+ function newListOrdersStep(configuration) {
45
+ const { connection, connectionName, listed, notFound, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
46
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
47
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.listOrders(), connection: connection.reference, branches: [
48
+ goToBranch("listed", listed),
49
+ ...notFound ? [goToBranch("notFound", notFound)] : [],
50
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
51
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
52
+ ...defect ? [goToBranch("defect", defect)] : []
53
+ ] });
54
+ }
55
+
56
+ // src/client.ts
57
+ import { SecretString } from "@superdurable/connectors-sdk";
58
+ import { BodyTooLargeError, isHeaderSafeCredential, parseRetryAfter, sendProviderRequest } from "@superdurable/connectors-sdk/providerhttp";
59
+
60
+ // src/operations.ts
61
+ import { newQueryBranch, newQueryRetry } from "@superdurable/connectors-sdk";
62
+ var emptyOrder = { id: 0, name: "", financial_status: "", total_price: "", currency: "" };
63
+ var emptyPage = { orders: [] };
64
+ var GetOrderOperation = class {
65
+ /** Bind the validated client. */
66
+ constructor(client) {
67
+ this.client = client;
68
+ }
69
+ client;
70
+ /** Return the manifest operation definition. */
71
+ definition() {
72
+ return GetOrderDefinition;
73
+ }
74
+ /** Validate and read one order. */
75
+ async invoke(call, input) {
76
+ if (!Number.isSafeInteger(input.orderId) || input.orderId <= 0) return failed("defect", "getOrder", "VALIDATION", "orderId must be positive", emptyOrder);
77
+ const result = await this.client.read(call, "getOrder", `/orders/${input.orderId}.json`);
78
+ if ("outcome" in result) return classify(result.outcome, emptyOrder);
79
+ try {
80
+ const body = parseObject(result.body);
81
+ const order = decodeOrder(body.order);
82
+ if (order.id <= 0) throw new TypeError("missing order");
83
+ return newQueryBranch("found", order);
84
+ } catch {
85
+ return failed("invalidResponse", "getOrder", "PROTOCOL", "provider returned invalid JSON", emptyOrder);
86
+ }
87
+ }
88
+ };
89
+ var ListOrdersOperation = class {
90
+ /** Bind the validated client. */
91
+ constructor(client) {
92
+ this.client = client;
93
+ }
94
+ client;
95
+ /** Return the manifest operation definition. */
96
+ definition() {
97
+ return ListOrdersDefinition;
98
+ }
99
+ /** Validate and read one page. */
100
+ async invoke(call, input) {
101
+ const limit = input.limit ?? 0;
102
+ if (!Number.isSafeInteger(limit) || limit < 0 || limit > 250) return failed("defect", "listOrders", "VALIDATION", "limit must be 1 through 250, or zero for provider default", emptyPage);
103
+ const query = new URLSearchParams();
104
+ if (limit > 0) query.set("limit", String(limit));
105
+ query.set("status", "any");
106
+ const result = await this.client.read(call, "listOrders", "/orders.json", query);
107
+ if ("outcome" in result) return classify(result.outcome, emptyPage);
108
+ try {
109
+ const body = parseObject(result.body);
110
+ if (!Array.isArray(body.orders)) throw new TypeError("missing orders");
111
+ return newQueryBranch("listed", { orders: body.orders.map(decodeOrder) });
112
+ } catch {
113
+ return failed("invalidResponse", "listOrders", "PROTOCOL", "provider returned invalid JSON", emptyPage);
114
+ }
115
+ }
116
+ };
117
+ function parseObject(body) {
118
+ const value = JSON.parse(Buffer.from(body).toString("utf8"));
119
+ if (value === null || Array.isArray(value) || typeof value !== "object") throw new TypeError("object expected");
120
+ return value;
121
+ }
122
+ function decodeOrder(value) {
123
+ if (value === null || Array.isArray(value) || typeof value !== "object") throw new TypeError("order expected");
124
+ const order = value;
125
+ const numberField = order.id ?? 0;
126
+ if (typeof numberField !== "number" || !Number.isSafeInteger(numberField)) throw new TypeError("id must be an integer");
127
+ const text = (key) => {
128
+ const field = order[key] ?? "";
129
+ if (typeof field !== "string") throw new TypeError("order text field expected");
130
+ return field;
131
+ };
132
+ return { id: numberField, name: text("name"), financial_status: text("financial_status"), total_price: text("total_price"), currency: text("currency") };
133
+ }
134
+ function classify(outcome, empty) {
135
+ if (outcome.branch === "retry") return newQueryRetry(outcome.failure, outcome.retryAfterMs);
136
+ return newQueryBranch(outcome.branch, empty, {}, outcome.failure);
137
+ }
138
+ function failed(branch, operation, kind, message, empty) {
139
+ return newQueryBranch(branch, empty, {}, { kind, provider: "shopify", operation, message });
140
+ }
141
+
142
+ // src/client.ts
143
+ var ShopifyClient = class {
144
+ baseURL;
145
+ timeoutMs;
146
+ maxResponseBytes;
147
+ credentials;
148
+ send;
149
+ /** Validate one shop connection without contacting Shopify. */
150
+ constructor(config, credentials, options = {}) {
151
+ if (!credentials) throw new TypeError("Shopify credential source is required");
152
+ if (!/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/.test(config.shopSubdomain)) throw new TypeError("shopSubdomain must contain lowercase letters, digits, or internal hyphens");
153
+ this.baseURL = `https://${config.shopSubdomain}.myshopify.com/admin/api/2026-10`;
154
+ this.timeoutMs = config.timeoutMs ?? 15e3;
155
+ this.maxResponseBytes = config.maxResponseBytes ?? 2097152;
156
+ if (!Number.isSafeInteger(this.timeoutMs) || this.timeoutMs <= 0) throw new TypeError("timeout must be positive");
157
+ if (!Number.isSafeInteger(this.maxResponseBytes) || this.maxResponseBytes <= 0) throw new TypeError("maxResponseBytes must be positive");
158
+ this.credentials = credentials;
159
+ this.send = options.send ?? sendProviderRequest;
160
+ }
161
+ /** Bind one order lookup. */
162
+ getOrder() {
163
+ return new GetOrderOperation(this);
164
+ }
165
+ /** Bind one order page lookup. */
166
+ listOrders() {
167
+ return new ListOrdersOperation(this);
168
+ }
169
+ /** Send one order read and apply Go's status classification. */
170
+ async read(call, operation, path, query) {
171
+ let token;
172
+ try {
173
+ const credentials = await this.credentials.resolve(call, call.context.cancellationSignal);
174
+ if (!(credentials.accessToken instanceof SecretString)) throw new TypeError("invalid token");
175
+ token = credentials.accessToken.reveal();
176
+ if (!token || !isHeaderSafeCredential(token)) throw new TypeError("invalid token");
177
+ } catch {
178
+ return { outcome: this.failure("defect", operation, "AUTHENTICATION", "Shopify credentials are unavailable") };
179
+ }
180
+ let response;
181
+ try {
182
+ response = await this.send({
183
+ url: this.baseURL + path + (query?.size ? `?${query.toString()}` : ""),
184
+ method: "GET",
185
+ headers: { Accept: "application/json", "X-Shopify-Access-Token": token },
186
+ maxResponseBytes: this.maxResponseBytes,
187
+ addressPolicy: "publicHTTPS",
188
+ timeoutMs: this.timeoutMs,
189
+ signal: call.context.cancellationSignal
190
+ });
191
+ } catch (error) {
192
+ if (error instanceof BodyTooLargeError) {
193
+ const statusFailure2 = error.status === void 0 ? null : this.classifyStatus(operation, error.status, error.headers ?? {});
194
+ return { outcome: statusFailure2 ?? this.failure("invalidResponse", operation, "RESPONSE_TOO_LARGE", "provider response exceeded the configured limit") };
195
+ }
196
+ return { outcome: this.failure("retry", operation, "AVAILABILITY", "provider read failed") };
197
+ }
198
+ const statusFailure = this.classifyStatus(operation, response.status, response.headers);
199
+ return statusFailure ? { outcome: statusFailure } : { body: response.body };
200
+ }
201
+ classifyStatus(operation, status, headers) {
202
+ const retryAfter = headers["retry-after"];
203
+ const delay = parseRetryAfter(Array.isArray(retryAfter) ? retryAfter[0] ?? "" : retryAfter ?? "");
204
+ if (status === 429) return this.failure("retry", operation, "RATE_LIMIT", "provider rate limited the read", delay);
205
+ if (status === 408 || status >= 500) return this.failure("retry", operation, "AVAILABILITY", "provider read is temporarily unavailable", delay);
206
+ if (status === 404) return this.failure("notFound", operation, "PROVIDER_REJECTION", "resource was not found");
207
+ if (status === 401) return this.failure("providerRejected", operation, "AUTHENTICATION", "provider rejected credentials");
208
+ if (status === 403) return this.failure("providerRejected", operation, "AUTHORIZATION", "provider denied access");
209
+ if (status !== 200) return this.failure("providerRejected", operation, "PROVIDER_REJECTION", `provider rejected read with HTTP ${status}`);
210
+ return null;
211
+ }
212
+ failure(branch, operation, kind, message, retryAfterMs = 0) {
213
+ return { branch, failure: { kind, provider: "shopify", operation, message }, retryAfterMs };
214
+ }
215
+ };
216
+
217
+ // src/project.ts
218
+ import { SecretString as SecretString2 } from "@superdurable/connectors-sdk";
219
+ import { z } from "zod";
220
+ var settingsSchema = z.strictObject({
221
+ shopSubdomain: z.string(),
222
+ timeout: z.union([z.string(), z.number().int()]).optional(),
223
+ maxResponseBytes: z.number().int().optional()
224
+ });
225
+ function newProjectConnection2(project, connectionName, options = {}) {
226
+ return newProjectConnection(project, connectionName, (loadedProject, name) => {
227
+ const selected = loadedProject.configuration.connections.find((entry) => entry.connectorId === "shopify" && entry.connectionName === name);
228
+ if (!selected) throw new TypeError("Shopify project connection is not configured");
229
+ const fields = settingsSchema.parse(selected.configuration);
230
+ const timeoutMs = typeof fields.timeout === "number" ? Math.ceil(fields.timeout / 1e6) : fields.timeout !== void 0 ? parseDurationMilliseconds(fields.timeout) : void 0;
231
+ const config = {
232
+ shopSubdomain: fields.shopSubdomain,
233
+ ...timeoutMs !== void 0 ? { timeoutMs } : {},
234
+ ...fields.maxResponseBytes !== void 0 ? { maxResponseBytes: fields.maxResponseBytes } : {}
235
+ };
236
+ const credentials = {
237
+ async resolve(_call, signal) {
238
+ const fields2 = await loadedProject.resolveCredential("shopify", name, signal);
239
+ if (typeof fields2.access_token !== "string" || !fields2.access_token) throw new TypeError("Shopify token is unavailable");
240
+ return { accessToken: new SecretString2(fields2.access_token) };
241
+ }
242
+ };
243
+ return new ShopifyClient(config, credentials, options);
244
+ });
245
+ }
246
+ function parseDurationMilliseconds(value) {
247
+ let remaining = value;
248
+ let milliseconds = 0;
249
+ const units = { ns: 1e-6, us: 1e-3, "\xB5s": 1e-3, ms: 1, s: 1e3, m: 6e4, h: 36e5 };
250
+ while (remaining) {
251
+ const component = /^(\d+(?:\.\d+)?)(ns|us|µs|ms|s|m|h)/.exec(remaining);
252
+ if (!component) throw new TypeError("Shopify timeout must be a positive Go duration");
253
+ milliseconds += Number(component[1]) * (units[component[2] ?? ""] ?? NaN);
254
+ remaining = remaining.slice(component[0].length);
255
+ }
256
+ if (!Number.isSafeInteger(milliseconds) || milliseconds <= 0) throw new TypeError("Shopify timeout must resolve to positive whole milliseconds");
257
+ return milliseconds;
258
+ }
259
+ export {
260
+ ConfigSchema,
261
+ Connection,
262
+ ConnectorID,
263
+ GetOrderBranch,
264
+ GetOrderBranchDefect,
265
+ GetOrderBranchFound,
266
+ GetOrderBranchInvalidResponse,
267
+ GetOrderBranchNotFound,
268
+ GetOrderBranchProviderRejected,
269
+ GetOrderDefinition,
270
+ GetOrderInputSchema,
271
+ GetOrderMetadata,
272
+ GetOrderOperation,
273
+ ListOrdersBranch,
274
+ ListOrdersBranchDefect,
275
+ ListOrdersBranchInvalidResponse,
276
+ ListOrdersBranchListed,
277
+ ListOrdersBranchNotFound,
278
+ ListOrdersBranchProviderRejected,
279
+ ListOrdersDefinition,
280
+ ListOrdersInputSchema,
281
+ ListOrdersMetadata,
282
+ ListOrdersOperation,
283
+ OrderPageSchema,
284
+ OrderSchema,
285
+ ProviderID,
286
+ ShopifyClient,
287
+ newConnection,
288
+ newConnectionWithOperations,
289
+ newGetOrderStep,
290
+ newListOrdersStep,
291
+ newProjectConnection2 as newProjectConnection
292
+ };
package/dist/mock.d.ts ADDED
@@ -0,0 +1,56 @@
1
+ import { MockQuery, Case } from '@superdurable/connectors-sdk/connectormock';
2
+ import { Failure } from '@superdurable/connectors-sdk';
3
+ import { d as Operations, C as Connection, G as GetOrderInput, O as Order, L as ListOrdersInput, a as OrderPage } from './connection-D5oSVoU-.js';
4
+ import 'zod';
5
+
6
+ /** Go zero value for GetOrderInput in scripted cases. */
7
+ declare const emptyGetOrderInput: GetOrderInput;
8
+ /** Go zero value for Order in scripted cases. */
9
+ declare const emptyOrder: Order;
10
+ /** Go zero value for ListOrdersInput in scripted cases. */
11
+ declare const emptyListOrdersInput: ListOrdersInput;
12
+ /** Go zero value for OrderPage in scripted cases. */
13
+ declare const emptyOrderPage: OrderPage;
14
+ /** Script the found branch. */
15
+ declare function getOrderFound(value: Order, failure?: Failure): Case<Order>;
16
+ /** Script the notFound branch. */
17
+ declare function getOrderNotFound(value: Order, failure?: Failure): Case<Order>;
18
+ /** Script the providerRejected branch. */
19
+ declare function getOrderProviderRejected(value: Order, failure?: Failure): Case<Order>;
20
+ /** Script the invalidResponse branch. */
21
+ declare function getOrderInvalidResponse(value: Order, failure?: Failure): Case<Order>;
22
+ /** Script the defect branch. */
23
+ declare function getOrderDefect(value: Order, failure?: Failure): Case<Order>;
24
+ /** Script a safe retry of getOrder. */
25
+ declare function getOrderRetry(failure: Failure, retryAfterMs?: number): Case<Order>;
26
+ /** Manifest scenario defaultAnswer for getOrder. */
27
+ declare function getOrderDefaultAnswer(): Case<Order>;
28
+ /** Default getOrder scenario. */
29
+ declare function getOrderDefault(): Case<Order>;
30
+ /** Script the listed branch. */
31
+ declare function listOrdersListed(value: OrderPage, failure?: Failure): Case<OrderPage>;
32
+ /** Script the notFound branch. */
33
+ declare function listOrdersNotFound(value: OrderPage, failure?: Failure): Case<OrderPage>;
34
+ /** Script the providerRejected branch. */
35
+ declare function listOrdersProviderRejected(value: OrderPage, failure?: Failure): Case<OrderPage>;
36
+ /** Script the invalidResponse branch. */
37
+ declare function listOrdersInvalidResponse(value: OrderPage, failure?: Failure): Case<OrderPage>;
38
+ /** Script the defect branch. */
39
+ declare function listOrdersDefect(value: OrderPage, failure?: Failure): Case<OrderPage>;
40
+ /** Script a safe retry of listOrders. */
41
+ declare function listOrdersRetry(failure: Failure, retryAfterMs?: number): Case<OrderPage>;
42
+ /** Manifest scenario defaultAnswer for listOrders. */
43
+ declare function listOrdersDefaultAnswer(): Case<OrderPage>;
44
+ /** Default listOrders scenario. */
45
+ declare function listOrdersDefault(): Case<OrderPage>;
46
+ /** Scripted operations and manifest defaults for this connector. */
47
+ declare class GeneratedMock implements Operations {
48
+ #private;
49
+ constructor(connectionName: string);
50
+ connection(): Connection;
51
+ getOrder(): MockQuery<GetOrderInput, Order>;
52
+ listOrders(): MockQuery<ListOrdersInput, OrderPage>;
53
+ assertNoFailures(): void;
54
+ }
55
+
56
+ export { GeneratedMock, emptyGetOrderInput, emptyListOrdersInput, emptyOrder, emptyOrderPage, getOrderDefault, getOrderDefaultAnswer, getOrderDefect, getOrderFound, getOrderInvalidResponse, getOrderNotFound, getOrderProviderRejected, getOrderRetry, listOrdersDefault, listOrdersDefaultAnswer, listOrdersDefect, listOrdersInvalidResponse, listOrdersListed, listOrdersNotFound, listOrdersProviderRejected, listOrdersRetry };
package/dist/mock.js ADDED
@@ -0,0 +1,123 @@
1
+ import {
2
+ GetOrderDefinition,
3
+ GetOrderInputSchema,
4
+ ListOrdersDefinition,
5
+ ListOrdersInputSchema,
6
+ OrderPageSchema,
7
+ OrderSchema,
8
+ ProviderID,
9
+ newConnectionWithOperations
10
+ } from "./chunk-A5SY2SHU.js";
11
+
12
+ // src/generated/mock.ts
13
+ import { branchCase, retryCase, newQuery } from "@superdurable/connectors-sdk/connectormock";
14
+ var emptyGetOrderInput = GetOrderInputSchema.parse({
15
+ "orderId": 0
16
+ });
17
+ var emptyOrder = OrderSchema.parse({
18
+ "id": 0,
19
+ "name": "",
20
+ "financial_status": "",
21
+ "total_price": "",
22
+ "currency": ""
23
+ });
24
+ var emptyListOrdersInput = ListOrdersInputSchema.parse({});
25
+ var emptyOrderPage = OrderPageSchema.parse({
26
+ "orders": []
27
+ });
28
+ function getOrderFound(value, failure) {
29
+ return branchCase("found", value, failure);
30
+ }
31
+ function getOrderNotFound(value, failure) {
32
+ return branchCase("notFound", value, failure);
33
+ }
34
+ function getOrderProviderRejected(value, failure) {
35
+ return branchCase("providerRejected", value, failure);
36
+ }
37
+ function getOrderInvalidResponse(value, failure) {
38
+ return branchCase("invalidResponse", value, failure);
39
+ }
40
+ function getOrderDefect(value, failure) {
41
+ return branchCase("defect", value, failure);
42
+ }
43
+ function getOrderRetry(failure, retryAfterMs = 0) {
44
+ return retryCase(failure, retryAfterMs);
45
+ }
46
+ function getOrderDefaultAnswer() {
47
+ const value = OrderSchema.parse({ "currency": "USD", "financial_status": "paid", "id": 101, "name": "#101", "total_price": "29.00" });
48
+ return branchCase("found", value);
49
+ }
50
+ function getOrderDefault() {
51
+ return getOrderDefaultAnswer();
52
+ }
53
+ function listOrdersListed(value, failure) {
54
+ return branchCase("listed", value, failure);
55
+ }
56
+ function listOrdersNotFound(value, failure) {
57
+ return branchCase("notFound", value, failure);
58
+ }
59
+ function listOrdersProviderRejected(value, failure) {
60
+ return branchCase("providerRejected", value, failure);
61
+ }
62
+ function listOrdersInvalidResponse(value, failure) {
63
+ return branchCase("invalidResponse", value, failure);
64
+ }
65
+ function listOrdersDefect(value, failure) {
66
+ return branchCase("defect", value, failure);
67
+ }
68
+ function listOrdersRetry(failure, retryAfterMs = 0) {
69
+ return retryCase(failure, retryAfterMs);
70
+ }
71
+ function listOrdersDefaultAnswer() {
72
+ const value = OrderPageSchema.parse({ "orders": [{ "currency": "USD", "financial_status": "paid", "id": 101, "name": "#101", "total_price": "29.00" }] });
73
+ return branchCase("listed", value);
74
+ }
75
+ function listOrdersDefault() {
76
+ return listOrdersDefaultAnswer();
77
+ }
78
+ var GeneratedMock = class {
79
+ #getOrder;
80
+ #listOrders;
81
+ #connection;
82
+ constructor(connectionName) {
83
+ this.#getOrder = newQuery(GetOrderDefinition).default(getOrderDefault());
84
+ this.#listOrders = newQuery(ListOrdersDefinition).default(listOrdersDefault());
85
+ this.#connection = newConnectionWithOperations(this, { provider: ProviderID, name: connectionName });
86
+ }
87
+ connection() {
88
+ return this.#connection;
89
+ }
90
+ getOrder() {
91
+ return this.#getOrder;
92
+ }
93
+ listOrders() {
94
+ return this.#listOrders;
95
+ }
96
+ assertNoFailures() {
97
+ this.#getOrder.assertNoFailures();
98
+ this.#listOrders.assertNoFailures();
99
+ }
100
+ };
101
+ export {
102
+ GeneratedMock,
103
+ emptyGetOrderInput,
104
+ emptyListOrdersInput,
105
+ emptyOrder,
106
+ emptyOrderPage,
107
+ getOrderDefault,
108
+ getOrderDefaultAnswer,
109
+ getOrderDefect,
110
+ getOrderFound,
111
+ getOrderInvalidResponse,
112
+ getOrderNotFound,
113
+ getOrderProviderRejected,
114
+ getOrderRetry,
115
+ listOrdersDefault,
116
+ listOrdersDefaultAnswer,
117
+ listOrdersDefect,
118
+ listOrdersInvalidResponse,
119
+ listOrdersListed,
120
+ listOrdersNotFound,
121
+ listOrdersProviderRejected,
122
+ listOrdersRetry
123
+ };
package/package.json CHANGED
@@ -1,6 +1,63 @@
1
1
  {
2
2
  "name": "@superdurable/connector-shopify",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "license": "MIT",
5
+ "description": "Shopify order reads for Dex Flows",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/superdurable/dex-connectors-library.git",
9
+ "directory": "connectors/shopify/typescript"
10
+ },
11
+ "type": "module",
12
+ "publishConfig": {
13
+ "access": "public",
14
+ "registry": "https://registry.npmjs.org"
15
+ },
16
+ "engines": {
17
+ "node": "^22.0.0 || ^24.0.0"
18
+ },
19
+ "module": "./dist/index.js",
20
+ "types": "./dist/index.d.ts",
21
+ "exports": {
22
+ ".": {
23
+ "types": "./dist/index.d.ts",
24
+ "import": "./dist/index.js"
25
+ },
26
+ "./mock": {
27
+ "types": "./dist/mock.d.ts",
28
+ "import": "./dist/mock.js"
29
+ }
30
+ },
31
+ "files": [
32
+ "dist",
33
+ "dex-connector.json",
34
+ "README.md",
35
+ "LICENSE"
36
+ ],
37
+ "scripts": {
38
+ "build": "tsup src/index.ts src/mock.ts --format esm --dts --clean",
39
+ "typecheck": "tsc --noEmit",
40
+ "lint": "eslint src test examples",
41
+ "test": "npm run build && vitest run --exclude 'test/integration/**'",
42
+ "test:integration": "npm run build && vitest run test/integration/*.integration.test.ts",
43
+ "check": "npm test && npm run typecheck && npm run lint",
44
+ "example:order": "npm run build && tsx examples/order-read/main.ts",
45
+ "example:order:start": "npm run build && tsx examples/order-read/start.ts"
46
+ },
47
+ "dependencies": {
48
+ "@superdurable/connectors-sdk": "0.1.0",
49
+ "@superdurable/dex": ">=1.28.0",
50
+ "zod": "^4.1.0"
51
+ },
52
+ "devDependencies": {
53
+ "@eslint/js": "^9.0.0",
54
+ "@types/node": "^22.0.0",
55
+ "eslint": "^9.0.0",
56
+ "tsup": "^8.0.0",
57
+ "tsx": "^4.23.15",
58
+ "typescript": "^5.9.0",
59
+ "typescript-eslint": "^8.0.0",
60
+ "vitest": "^3.0.0",
61
+ "yaml": "^2.9.1"
62
+ }
63
+ }