@rbxts/zyntex-sdk 1.0.1 → 1.0.3

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/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  // types/zyntex.d.ts
2
+ import {Telemetry} from "./telemetry";
3
+
2
4
  interface ZyntexConfig {}
3
5
 
4
6
  interface Invocation {
@@ -7,58 +9,75 @@ interface Invocation {
7
9
  data: unknown;
8
10
  to: string;
9
11
  sender: string;
10
- from_server: string
11
- invoked_at: number;
12
+ from_server: string;
13
+ invoked_at: number[];
12
14
  to_server: string;
13
15
  game_id: string;
14
16
  invoked_by: string;
15
17
  }
18
+
16
19
  interface ZyntexEvent {
17
- Connect(callback: (invocation: Invocation)=>void): void
20
+ Connect(callback: (invocation: Invocation) => void): void;
18
21
  }
19
- interface Zyntex {
22
+ export interface Zyntex {
20
23
  /*
21
- @method Zyntex:init
22
- @description The main entry point to start the Zyntex client. This function initializes all core processes:
23
- it registers the server with the Zyntex backend, starts the status update and polling loops,
24
- sets up event listeners, and connects player tracking signals.
24
+ @method Zyntex:init
25
+ @description The main entry point to start the Zyntex client. This function initializes all core processes:
26
+ it registers the server with the Zyntex backend, starts the status update and polling loops,
27
+ sets up event listeners, and connects player tracking signals.
25
28
 
26
- @param self Zyntex
27
- @param config TYPES.Config -- A configuration table that controls client behavior (e.g., `debug`, `simulate`).
28
- */
29
+ @param self Zyntex
30
+ @param config TYPES.Config -- A configuration table that controls client behavior (e.g., debug, simulate).
31
+ */
29
32
  init(config: ZyntexConfig): void;
30
-
31
33
  /*
32
- @method Event:Connect
33
- @description Establishes a listener for this specific event. The provided callback function
34
- will be executed whenever an invocation for this event is received from the Zyntex backend (e.g., sent from the dashboard).
34
+ @method Event:Connect
35
+ @description Establishes a listener for this specific event. The provided callback function
36
+ will be executed whenever an invocation for this event is received from the Zyntex backend (e.g., sent from the dashboard).
35
37
 
36
- @param self Event -- The event object to listen to.
37
- @param listener (({[string]: any}, Invocation) -> nil) -- The callback function to execute.
38
- - The first argument passed to the listener is a simplified data table: `{["key"] = value}`.
39
- - The second argument is the full, raw Invocation object.
38
+ @param self Event -- The event object to listen to.
39
+ @param listener (({[string]: any}, Invocation) -> nil) -- The callback function to execute.
40
+ - The first argument passed to the listener is a simplified data table: {["key"] = value}.
41
+ - The second argument is the full, raw Invocation object.
40
42
 
41
- @example
42
- local broadcastEvent = Zyntex:GetEvent("BroadcastMessage")
43
- broadcastEvent:Connect(function(data, invocation)
44
- print(`Received broadcast from user {invocation.invokedBy}: {data.Message}`)
45
- end)
46
- */
43
+ @example
44
+ local broadcastEvent = Zyntex:GetEvent("BroadcastMessage")
45
+ broadcastEvent:Connect(function(data, invocation)
46
+ print(Received broadcast from user {invocation.invokedBy}: {data.Message})
47
+ end)
48
+ */
47
49
  GetEvent(name: string): ZyntexEvent;
48
- // Add other Zyntex instance methods here
50
+ /*
51
+ @method Zyntex:ProcessPurchase
52
+ @description Logs a player's in-game purchase. This should be wired up to `MarketplaceService.ProcessReceipt`
53
+ to track player spending and LTV on the dashboard.
54
+
55
+ @param self Zyntex
56
+ @param player (Player | number) -- The Player object or UserId who made the purchase.
57
+ @param price number -- The price of the item in Robux.
58
+ @param productName string -- The name of the product purchased. Using the name is preferred over the ID for clarity on the dashboard.
59
+ @return boolean -- Returns `true` on success.
60
+ */
61
+ ProcessPurchase(player: Player|number,currencySpent:number, productName: string): boolean;
62
+ /*
63
+ @method Zyntex:Telemetry
64
+ @description Constructs a new Telemetry object used for prometheus-style metrics.
65
+ @param flushEvery number? -- How often to flush the buffer in seconds. Default is 10,
66
+ which is the minimum to not get ratelimited.
67
+ @param registryName string? -- The name of the registry. Default is "default"
68
+ */
69
+ Telemetry(flushEvery?: number,registryName?: string): Telemetry;
49
70
  }
50
71
 
51
- interface ZyntexModule {
72
+ export interface ZyntexModule {
52
73
  /**
53
74
  * Creates a new Zyntex instance using the provided game token.
54
75
  */
55
76
  (gameToken: string): Zyntex;
56
-
57
77
  /**
58
78
  * The current version string of the Zyntex module.
59
79
  */
60
80
  readonly version: string;
61
-
62
81
  /**
63
82
  * Used by the upgrader plugin to detect Zyntex.
64
83
  */
@@ -66,4 +85,5 @@ interface ZyntexModule {
66
85
  }
67
86
 
68
87
  declare const ZyntexModule: ZyntexModule;
69
- export default ZyntexModule;
88
+
89
+ export default ZyntexModule;
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@rbxts/zyntex-sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Typescript types for: The Roblox Zyntex SDK.",
5
5
  "main": "init.lua",
6
6
  "license": "MIT",
7
7
  "types": "index.d.ts",
8
8
  "publishConfig": {
9
9
  "access": "public"
10
+ },
11
+ "dependencies": {
12
+ "@rbxts/types": "^1.0.867"
10
13
  }
11
14
  }
package/telemetry.d.ts ADDED
@@ -0,0 +1,49 @@
1
+ // types/telemetry.d.ts
2
+
3
+
4
+ export type LabelSet = Record<string, string>;
5
+
6
+ export interface MetricOpts {
7
+ /**
8
+ * Optional human-readable description
9
+ */
10
+ description?: string;
11
+
12
+ /**
13
+ * Labels, used for filtering metrics on the dashboard
14
+ */
15
+ labels?: string[];
16
+
17
+ /**
18
+ * Only for Histogram
19
+ */
20
+ buckets?: number[];
21
+ }
22
+
23
+ export interface CounterMetric {
24
+ inc(delta?: number, labels?: LabelSet): void;
25
+ }
26
+
27
+ export interface GaugeMetric {
28
+ set(value: number, labels?: LabelSet): void;
29
+ inc(delta?: number, labels?: LabelSet): void;
30
+ dec(delta?: number, labels?: LabelSet): void;
31
+ }
32
+
33
+ export interface HistogramMetric {
34
+ observe(value: number, labels?: LabelSet): void;
35
+ }
36
+
37
+ export interface SummaryMetric {
38
+ observe(value: number, labels?: LabelSet): void;
39
+ }
40
+
41
+ export interface Telemetry {
42
+ flush(): void;
43
+
44
+ Counter(name: string, opts?: MetricOpts): CounterMetric;
45
+ Gauge(name: string, opts?: MetricOpts): GaugeMetric;
46
+ Histogram(name: string, opts?: MetricOpts): HistogramMetric;
47
+ Summary(name: string, opts?: MetricOpts): SummaryMetric;
48
+ }
49
+
package/.eslintrc DELETED
@@ -1,23 +0,0 @@
1
- {
2
- "parser": "@typescript-eslint/parser",
3
- "parserOptions": {
4
- "jsx": true,
5
- "useJSXTextNode": true,
6
- "ecmaVersion": 2018,
7
- "sourceType": "module",
8
- "project": "./tsconfig.json"
9
- },
10
- "ignorePatterns": [
11
- "/out"
12
- ],
13
- "plugins": [
14
- "@typescript-eslint",
15
- "roblox-ts"
16
- ],
17
- "extends": [
18
- "eslint:recommended",
19
- "plugin:@typescript-eslint/recommended",
20
- "plugin:roblox-ts/recommended"
21
- ],
22
- "rules": {}
23
- }
package/.idea/discord.xml DELETED
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="DiscordProjectSettings">
4
- <option name="show" value="ASK" />
5
- <option name="description" value="" />
6
- </component>
7
- </project>
@@ -1,6 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <profile version="1.0">
3
- <option name="myName" value="Project Default" />
4
- <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
- </profile>
6
- </component>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/zyntex-sdk-typescript.iml" filepath="$PROJECT_DIR$/.idea/zyntex-sdk-typescript.iml" />
6
- </modules>
7
- </component>
8
- </project>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>
@@ -1,12 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$">
5
- <excludeFolder url="file://$MODULE_DIR$/.tmp" />
6
- <excludeFolder url="file://$MODULE_DIR$/temp" />
7
- <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
- </content>
9
- <orderEntry type="inheritedJdk" />
10
- <orderEntry type="sourceFolder" forTests="false" />
11
- </component>
12
- </module>
Binary file
package/tsconfig.json DELETED
@@ -1,31 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- // required
4
- "allowSyntheticDefaultImports": true,
5
- "downlevelIteration": true,
6
- "jsx": "react",
7
- "jsxFactory": "React.createElement",
8
- "jsxFragmentFactory": "React.Fragment",
9
- "module": "commonjs",
10
- "moduleResolution": "Node",
11
- "noLib": true,
12
- "resolveJsonModule": true,
13
- "forceConsistentCasingInFileNames": true,
14
- "moduleDetection": "force",
15
- "strict": true,
16
- "target": "ESNext",
17
- "typeRoots": [
18
- "node_modules/@rbxts",
19
- ],
20
- // configurable
21
- "rootDir": "",
22
- "outDir": "",
23
- "baseUrl": "",
24
- "incremental": true,
25
- "tsBuildInfoFile": "out/tsconfig.tsbuildinfo",
26
- "experimentalDecorators": true,
27
- "importHelpers": true,
28
- "plugins": [
29
- ]
30
- }
31
- }