@itm-studio/partner-sdk 0.2.7 → 0.2.9
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/README.md +100 -0
- package/dist/index.d.mts +121 -1
- package/dist/index.d.ts +121 -1
- package/dist/index.js +225 -73
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +225 -73
- package/dist/index.mjs.map +1 -1
- package/dist/unsupported-runtime.d.mts +2 -0
- package/dist/unsupported-runtime.d.ts +2 -0
- package/dist/unsupported-runtime.js +9 -0
- package/dist/unsupported-runtime.js.map +1 -0
- package/dist/unsupported-runtime.mjs +7 -0
- package/dist/unsupported-runtime.mjs.map +1 -0
- package/package.json +15 -3
- package/schema/partner.graphql +80 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/runtime.ts
|
|
4
|
+
var NODE_SERVER_ONLY_ERROR = "ITM Partner SDK is Node-server-only. Do not import it in browser, React Native, worker, edge, or Electron process code. Call it from a Node backend and return only the data the client needs.";
|
|
5
|
+
|
|
6
|
+
// src/unsupported-runtime.ts
|
|
7
|
+
throw new Error(NODE_SERVER_ONLY_ERROR);
|
|
8
|
+
//# sourceMappingURL=unsupported-runtime.js.map
|
|
9
|
+
//# sourceMappingURL=unsupported-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/runtime.ts","../src/unsupported-runtime.ts"],"names":[],"mappings":";;;AAAO,IAAM,sBAAA,GACX,gMAAA;;;ACCF,MAAM,IAAI,MAAM,sBAAsB,CAAA","file":"unsupported-runtime.js","sourcesContent":["export const NODE_SERVER_ONLY_ERROR =\n 'ITM Partner SDK is Node-server-only. Do not import it in browser, React Native, worker, edge, or Electron process code. Call it from a Node backend and return only the data the client needs.';\n\ninterface RuntimeGlobals {\n process?: {\n release?: { name?: string };\n versions?: { node?: string; electron?: string };\n type?: string;\n };\n window?: unknown;\n navigator?: { product?: string };\n}\n\n/**\n * Enforce the SDK's Node-server-only credential boundary.\n *\n * Conditional package exports reject supported client bundlers before this\n * runs. This assertion protects direct artifact imports and legacy resolvers.\n */\nexport function assertNodeServerRuntime(\n runtime: RuntimeGlobals = globalThis as RuntimeGlobals,\n): void {\n const runtimeProcess = runtime.process;\n const isNode =\n runtimeProcess?.release?.name === 'node' &&\n typeof runtimeProcess.versions?.node === 'string';\n const isBrowserWindow = typeof runtime.window !== 'undefined';\n const isReactNative = runtime.navigator?.product === 'ReactNative';\n const isElectron =\n typeof runtimeProcess?.versions?.electron === 'string' ||\n typeof runtimeProcess?.type === 'string';\n\n if (!isNode || isBrowserWindow || isReactNative || isElectron) {\n throw new Error(NODE_SERVER_ONLY_ERROR);\n }\n}\n","import { NODE_SERVER_ONLY_ERROR } from './runtime';\n\nthrow new Error(NODE_SERVER_ONLY_ERROR);\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// src/runtime.ts
|
|
2
|
+
var NODE_SERVER_ONLY_ERROR = "ITM Partner SDK is Node-server-only. Do not import it in browser, React Native, worker, edge, or Electron process code. Call it from a Node backend and return only the data the client needs.";
|
|
3
|
+
|
|
4
|
+
// src/unsupported-runtime.ts
|
|
5
|
+
throw new Error(NODE_SERVER_ONLY_ERROR);
|
|
6
|
+
//# sourceMappingURL=unsupported-runtime.mjs.map
|
|
7
|
+
//# sourceMappingURL=unsupported-runtime.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/runtime.ts","../src/unsupported-runtime.ts"],"names":[],"mappings":";AAAO,IAAM,sBAAA,GACX,gMAAA;;;ACCF,MAAM,IAAI,MAAM,sBAAsB,CAAA","file":"unsupported-runtime.mjs","sourcesContent":["export const NODE_SERVER_ONLY_ERROR =\n 'ITM Partner SDK is Node-server-only. Do not import it in browser, React Native, worker, edge, or Electron process code. Call it from a Node backend and return only the data the client needs.';\n\ninterface RuntimeGlobals {\n process?: {\n release?: { name?: string };\n versions?: { node?: string; electron?: string };\n type?: string;\n };\n window?: unknown;\n navigator?: { product?: string };\n}\n\n/**\n * Enforce the SDK's Node-server-only credential boundary.\n *\n * Conditional package exports reject supported client bundlers before this\n * runs. This assertion protects direct artifact imports and legacy resolvers.\n */\nexport function assertNodeServerRuntime(\n runtime: RuntimeGlobals = globalThis as RuntimeGlobals,\n): void {\n const runtimeProcess = runtime.process;\n const isNode =\n runtimeProcess?.release?.name === 'node' &&\n typeof runtimeProcess.versions?.node === 'string';\n const isBrowserWindow = typeof runtime.window !== 'undefined';\n const isReactNative = runtime.navigator?.product === 'ReactNative';\n const isElectron =\n typeof runtimeProcess?.versions?.electron === 'string' ||\n typeof runtimeProcess?.type === 'string';\n\n if (!isNode || isBrowserWindow || isReactNative || isElectron) {\n throw new Error(NODE_SERVER_ONLY_ERROR);\n }\n}\n","import { NODE_SERVER_ONLY_ERROR } from './runtime';\n\nthrow new Error(NODE_SERVER_ONLY_ERROR);\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itm-studio/partner-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "TypeScript SDK for the ITM Partner API — typed GraphQL client with zero introspection required",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -8,10 +8,20 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
11
|
+
"browser": null,
|
|
12
|
+
"react-native": null,
|
|
13
|
+
"node": {
|
|
14
|
+
"import": "./dist/index.mjs",
|
|
15
|
+
"require": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"default": null
|
|
13
18
|
}
|
|
14
19
|
},
|
|
20
|
+
"browser": {
|
|
21
|
+
"./dist/index.js": "./dist/unsupported-runtime.js",
|
|
22
|
+
"./dist/index.mjs": "./dist/unsupported-runtime.mjs"
|
|
23
|
+
},
|
|
24
|
+
"react-native": "./dist/unsupported-runtime.js",
|
|
15
25
|
"files": [
|
|
16
26
|
"dist",
|
|
17
27
|
"schema"
|
|
@@ -20,6 +30,7 @@
|
|
|
20
30
|
"generate": "genql --schema ./schema/partner.graphql --output ./src/generated",
|
|
21
31
|
"build": "npm run generate && tsup",
|
|
22
32
|
"test": "vitest run",
|
|
33
|
+
"test:package-guards": "node scripts/verify-runtime-guards.mjs",
|
|
23
34
|
"test:watch": "vitest",
|
|
24
35
|
"lint": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.test.json",
|
|
25
36
|
"prepublishOnly": "npm run build",
|
|
@@ -38,6 +49,7 @@
|
|
|
38
49
|
"devDependencies": {
|
|
39
50
|
"@genql/cli": "^6.3.3",
|
|
40
51
|
"@graphql-hive/cli": "^0.46.0",
|
|
52
|
+
"esbuild": "0.27.3",
|
|
41
53
|
"msw": "^2.7.0",
|
|
42
54
|
"tsup": "^8.4.0",
|
|
43
55
|
"typescript": "^5.7.0",
|
package/schema/partner.graphql
CHANGED
|
@@ -504,6 +504,69 @@ type PartnerMomentStats {
|
|
|
504
504
|
ticketRsvpRequestsCount: Int!
|
|
505
505
|
}
|
|
506
506
|
|
|
507
|
+
type PartnerMomentAttendanceCount {
|
|
508
|
+
total: Int!
|
|
509
|
+
checkedIn: Int!
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
type PartnerMomentTicketTierAttendance {
|
|
513
|
+
total: Int!
|
|
514
|
+
checkedIn: Int!
|
|
515
|
+
tierUid: String!
|
|
516
|
+
name: String!
|
|
517
|
+
label: String
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
type PartnerMomentTicketAttendance {
|
|
521
|
+
total: Int!
|
|
522
|
+
checkedIn: Int!
|
|
523
|
+
tiers: [PartnerMomentTicketTierAttendance!]!
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
type PartnerMomentGuestlistLabelAttendance {
|
|
527
|
+
total: Int!
|
|
528
|
+
checkedIn: Int!
|
|
529
|
+
labelUid: String!
|
|
530
|
+
name: String!
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
type PartnerMomentGuestlistAttendance {
|
|
534
|
+
total: Int!
|
|
535
|
+
checkedIn: Int!
|
|
536
|
+
unlabeled: PartnerMomentAttendanceCount!
|
|
537
|
+
labels: [PartnerMomentGuestlistLabelAttendance!]!
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
type PartnerMomentAttendanceStats {
|
|
541
|
+
momentUid: String!
|
|
542
|
+
momentSlug: String!
|
|
543
|
+
generatedAt: DateTime!
|
|
544
|
+
tickets: PartnerMomentTicketAttendance!
|
|
545
|
+
guestlist: PartnerMomentGuestlistAttendance!
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
enum EventImportPlatform {
|
|
549
|
+
EVENTBRITE
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
input PartnerMomentAttendanceLookupInput {
|
|
553
|
+
"""
|
|
554
|
+
ITM moment UID. Provide exactly one of momentUid, momentSlug, or externalPlatform with externalId.
|
|
555
|
+
"""
|
|
556
|
+
momentUid: String
|
|
557
|
+
|
|
558
|
+
"""
|
|
559
|
+
ITM moment slug. Provide exactly one of momentUid, momentSlug, or externalPlatform with externalId.
|
|
560
|
+
"""
|
|
561
|
+
momentSlug: String
|
|
562
|
+
|
|
563
|
+
"""Source platform for externalId, for example EVENTBRITE."""
|
|
564
|
+
externalPlatform: EventImportPlatform
|
|
565
|
+
|
|
566
|
+
"""Opaque source-platform event ID. Must be provided together with externalPlatform."""
|
|
567
|
+
externalId: String
|
|
568
|
+
}
|
|
569
|
+
|
|
507
570
|
type MomentCollectionLink {
|
|
508
571
|
uid: ID!
|
|
509
572
|
url: String!
|
|
@@ -880,6 +943,13 @@ type MomentLineupResponseResult {
|
|
|
880
943
|
success: Boolean!
|
|
881
944
|
}
|
|
882
945
|
|
|
946
|
+
input PartnerMomentsFiltersInput {
|
|
947
|
+
"""
|
|
948
|
+
When true, includes private moments owned by the authenticated brand. Default: false.
|
|
949
|
+
"""
|
|
950
|
+
includePrivate: Boolean
|
|
951
|
+
}
|
|
952
|
+
|
|
883
953
|
# ─── Queries ─────────────────────────────────────────────────────────────────
|
|
884
954
|
|
|
885
955
|
type Query {
|
|
@@ -896,6 +966,7 @@ type Query {
|
|
|
896
966
|
cursor: String
|
|
897
967
|
take: Int
|
|
898
968
|
status: MomentStatus
|
|
969
|
+
filters: PartnerMomentsFiltersInput
|
|
899
970
|
"""Sort order for moments by start date (default: DESC - newest to oldest)"""
|
|
900
971
|
sortOrder: MomentSortOrder
|
|
901
972
|
): GetPublicMomentsResponse!
|
|
@@ -924,6 +995,15 @@ type Query {
|
|
|
924
995
|
"""
|
|
925
996
|
getPartnerMomentStats(momentSlug: String!): PartnerMomentStats
|
|
926
997
|
|
|
998
|
+
"""
|
|
999
|
+
Get a cached attendance snapshot for a partner-owned moment; counts can be
|
|
1000
|
+
up to five minutes old. Look up by exactly one of momentUid, momentSlug, or
|
|
1001
|
+
externalPlatform with externalId. Returns null when no owned moment matches.
|
|
1002
|
+
"""
|
|
1003
|
+
getPartnerMomentAttendanceStats(
|
|
1004
|
+
input: PartnerMomentAttendanceLookupInput!
|
|
1005
|
+
): PartnerMomentAttendanceStats
|
|
1006
|
+
|
|
927
1007
|
"""
|
|
928
1008
|
Get paginated tickets for a moment.
|
|
929
1009
|
"""
|